cdo-climatecdo.message

How can compute "Mean Absolute Error (MAE)" by CDO


I did not find as a new student how to calculate "Mean Absolute Error (MAE)" by CDO! Can you assist us with how to compute by CDO!


Solution

  • if you have your observations (or analysis?) in obs.nc and model in model.nc then you can calculate the MAE in the following way

    # calculate the difference 
    cdo sub model.nc obs.nc diff.nc   
    
    # absolute value
    cdo abs diff.nc abs.nc 
    
    # time mean
    cdo timmean abs.nc MAE.nc 
    

    or piping it all in one line:

    cdo timmean -abs -sub model.nc obs.nc MAE.nc 
    

    If instead of the temporal mean you need the spatial MAE then of course you replace timmean with fldmean