python vs cdo - timeseries mean
Added by Sarah O'Keefe over 7 years ago
Hi - I have a mystery. I have a little script that uses python to get the field and time mean of an input file that is on a regular latlon grid (see attached for script and file) . BUT when I run cdo fldmean, timmean I get a very different result. Any ideas what is going on? If it is the result of grid area weighting, is there any way to turn this off? Thanks! Sarah.
chirps_short.nc (31.6 MB) chirps_short.nc | |||
Validation_Month_SEB.py (922 Bytes) Validation_Month_SEB.py |
Replies (1)
RE: python vs cdo - timeseries mean - Added by Ralf Mueller over 7 years ago
Hi Sarah!
sorry for the delay.
Your assumption is correct - cdo fldmean
is an area weighted mean value. np.mean
is just a plain mean value
you can do a simple mean with cdo like this
cdo -divc,$(cdo -ngridpoints <ifile>) -fldsum <ifile> <ofile>
hth
ralf