Project

General

Profile

different RMSE values calculated by CDO and NCL

Added by Qi LI about 9 years ago

Dear CDO community,

I would like to calculate spatial RMSE of simulations and observations.

I use the following CDO commands to do the calculation:

cdo sqrt -fldmean -sqr -sub sim.nc obs.nc rmse.nc

However, the CDO output (64.44424) is different from the NCL one (63.95646), and I couldn't figure out why.

below is the NCL function I use and its related description:
rmse = dim_rmsd_n(obs, sim, (/1,2/)), where (/1,2/) represents the spatial dimensions lon,lat
http://www.ncl.ucar.edu/Document/Functions/Built-in/dim_rmsd_n.shtml

attached are the two .nc files

Any hint is much appreciated!


Replies (7)

RE: different RMSE values calculated by CDO and NCL - Added by Jaison-Thomas Ambadan about 9 years ago

CDO computes area weighted mean, so the difference is may be due to that. Have a look at CDO doc section: 1.3.1 Grid area weights

also try

cdo -s output -sqrt -divc,TOTAL_NUMBER_OF_GRIDPOINTS -fldsum -sqr -sub sim.nc obs.nc

replace TOTAL_NUMBER_OF_GRIDPOINTS with total number of gridpoints

that may give you an answer close to NCL (I didn't check NCL)

RE: different RMSE values calculated by CDO and NCL - Added by Jaison-Thomas Ambadan about 9 years ago

also there are missing values in your input files, so subtract the number of grid-points with missing values from the total number of gridpoints (for divc,TOTAL_NUMBER_OF_GRIDPOINTS) that will give you an output which is same as NCL. Here is my number: 63.956453!

RE: different RMSE values calculated by CDO and NCL - Added by Uwe Schulzweida about 9 years ago

Yes, the difference came from the area weighted mean with fldmean. Here is an example without weights:

cdo -s output -sqrt -fldmean -setgrid,g89x74 -sqr -sub sim.nc obs.nc
Jaison's example should give the same result for datasets without missing values.

RE: different RMSE values calculated by CDO and NCL - Added by Qi LI about 9 years ago

Hi Jaison,

Thank you for your quick reply!

I was wondering when to use the area weighted mean and when not? in this case the data is on a limited area, does this matter?

RE: different RMSE values calculated by CDO and NCL - Added by Qi LI about 9 years ago

Thank you Uwe!
does it mean I shouldn't use fldmean in this case and the output is wrong?

RE: different RMSE values calculated by CDO and NCL - Added by Jaison-Thomas Ambadan about 9 years ago

I was wondering when to use the area weighted mean and when not? in this case the data is on a limited area, does this matter?

It depends. Have a look at: https://en.wikipedia.org/wiki/Weighted_arithmetic_mean and some google-ing you'll find your answer.

does it mean I shouldn't use fldmean in this case and the output is wrong?

In most cases fldmean is preferable (again it depends ...)

    (1-7/7)