Project

General

Profile

Compute Bias and RMSE between observations and simulations in 2 different NC files

Added by david moreno over 6 years ago

Hey all,

I have 2 netcdf files, one with gridded obs and another one with gridded simulations (same grid dims) and I need to compute the bias and rmse for one of the variables, preferably outputting the bias and RMSE to a new nc file.

So, it would be something like Bias=sum(obs(file1)-sim(file2))/ntimes.

Is there an (easy) way to do this with CDO or NCO?

Thanks!


Replies (8)

RE: Compute Bias and RMSE between observations and simulations in 2 different NC files - Added by Karin Meier-Fleischer over 6 years ago

Hi David,

use the operator chaining like

 cdo -timavg -sub file1 file2 outfile

-Karin

RE: Compute Bias and RMSE between observations and simulations in 2 different NC files - Added by david moreno over 6 years ago

Thanks Karin,

But the timavg operator computes a time average, not the Bias or rmse right?

RE: Compute Bias and RMSE between observations and simulations in 2 different NC files - Added by Karin Meier-Fleischer over 6 years ago

It is the same as your Bias above Bias=sum(obs(file1)-sim(file2))/ntime which does a time average (sum/ntimes).

But you can do

cdo -divc,ntimes -timsum -sub file1 file2 outfile

the results are the same.

To compute RMSE

cdo -sqrt -fldmean -sqr -sub file1 file2 RMSE.nc

-Karin

RE: Compute Bias and RMSE between observations and simulations in 2 different NC files - Added by Karin Meier-Fleischer over 6 years ago

RMSE definition is RMSE=sqrt(mean((forecast-observed)^2)) so it must be

cdo -sqrt -fldmean -sqr -sub file2 file1 RMSE.nc

RE: Compute Bias and RMSE between observations and simulations in 2 different NC files - Added by david moreno over 6 years ago

Thank you so much for the help Karin!

And the variables need to have the same name in both input files, or I can define which vars to use in the computations?

RE: Compute Bias and RMSE between observations and simulations in 2 different NC files - Added by Karin Meier-Fleischer over 6 years ago

Yes, they should have the same name, if not use chname operator to change the variable name.

RE: Compute Bias and RMSE between observations and simulations in 2 different NC files - Added by ray kettaren over 1 year ago

Hello Karin!
I have similar problem due making bias (precipitation) : bias = [(RCM-eobs)/eobs]*100
But I got totally unrealistic values. Can you please help. This is the command I used.
At first, i made substract from RCM-EOBS. The result is correct. But when I use the second command the result becomes really unrealistic.

cdo sub pr_djf.nc eobs_pr_djfnewunit.nc subpr_bias.nc
cdo mulc,100 -div subpr_bias.nc eobs_pr_djfnewunit.nc bias_pr_cru-ens.nc

RE: Compute Bias and RMSE between observations and simulations in 2 different NC files - Added by Ralf Mueller over 1 year ago

your CDO calls look fine. So the numbers are coming from earlier computations I guess.

    (1-8/8)