why cdo and nco give slightly different result in averaging
Added by mubashar dogar about 12 years ago
Hi CDO users,
I have 10 years monthly data in a netcdf file (asmsw.nc). I applied cdo and nco command on the same file to find time average and checked the difference of the averaged variable from both methods in GrADS. The difference is not exactly zero, although it is very very small (10^-7). Why is it so? You could test it at your level for any variable of your netcdf file to get an idea.
ncwa -x -v time -a time asmsw.nc nco_tavg.nc
cdo timmean asmsw.nc cdo_tavg.nc
Thanks,
Mubashar
Replies (4)
RE: why cdo and nco give slightly different result in averaging - Added by Jaison-Thomas Ambadan about 12 years ago
Hi,
I don't see any difference between CDO (v1.5.8) and NCO commands. Attached is an example input file, and some commands that I used.
1. cdo -b F64 -timavg ifile.nc ofile_timavg.nc 2. cdo -b F64 -timmean ifile.nc ofile_timmean.nc 3. cdo -b F64 -divc,56 -timsum ifile.nc ofile_timsum_divc.nc 4. ncwa -x -v time -a time ifile.nc ofile_ncwa.nc and cdo outputf,%64.32f,1 ofile_timmean.nc cdo outputf,%64.32f,1 ofile_timavg.nc cdo outputf,%64.32f,1 ofile_timsum_divc.nc cdo outputf,%64.32f,1 ofile_ncwa.nc
All show ONE value: 55953.47440011160506401211023330688477
The difference may be due to missing values or due to the fact that cdo uses weighted average. For more details, please have a look at
https://code.zmaw.de/embedded/cdo/1.5.9/cdo.html#x1-290001.7.1
https://code.zmaw.de/embedded/cdo/1.5.9/cdo.html#x1-120001.3.1
Anyway, hope this helps.
Cheers,
J.
RE: why cdo and nco give slightly different result in averaging - Added by mubashar dogar about 12 years ago
Hi,
Could you please check with the attached file "asmsw_1991-1994.nc" cdo and nco time average commands as you did above & see that they are different. I don't know what's wrong.
Thanks,
Mubashar
asmsw_1991-1994.nc (8.9 MB) asmsw_1991-1994.nc |
RE: why cdo and nco give slightly different result in averaging - Added by Jaison-Thomas Ambadan about 12 years ago
Hi,
from ncdump -h:
time:calendar = "julian" ;
"CDO doesn't support a pure Julian calendar." I assume the "possible" slight difference in your result is due to this.
Anyway, please have a look at the following thread (reply by Uwe to your previous query) https://code.zmaw.de/boards/1/topics/1690#message-1693
Cheers,
J
Standardized monthly Anomaly - Added by mubashar dogar almost 12 years ago
Hi CDO users,
I have seen CDO command to compute multi year monthly anomalies as follows:
cdo ymonsub ifile -ymonavg ifile ofile (please confirm if it computes monthly anomalies over all the years let say "Jan1990-mean of all Jan over all the years" and so on for rest months)
I have 10 years monthly data (Jan1990 till Dec 1999) and wanted to compute standardized monthly anomaly. Above method gives monthly anomalies only. I have to divide by corresponding standard deviation of each month.
i.e (Jan1990-mean of all Januaries)/std of all Januaries and so on for all the rest months.
At the end my output file will have standardized anomalies for all the 10 years (120 months).
How could I do that?
Thanks,
Mubashar