average/sum over any chosen dimension
Added by Erik Noble almost 13 years ago
Hi. Maybe I am missing it in the CDO refcard or the documentation, but is there a command for averaging a variable/ file over one of its dimensions, not just time?
For instance, if I have rain(time,lat,lon), and I want rain(time,lon) averaged over lat, is there a command for this?
Sincerely,
Erik
Replies (5)
RE: average/sum over any chosen dimension - Added by Jaison-Thomas Ambadan almost 13 years ago
Hi Erik,
Yes off-course CDO has all the operators that you need!
See CDO documentation, Section 2.8.7 MERSTAT - Meridional statistical values
For mean, the operators are "mermean" or "meravg"
https://code.zmaw.de/embedded/cdo/1.5.4/cdo.html#x1-2880002.8.7
For Zonal average: see section 2.8.6 ZONSTAT - Zonal statistical values
https://code.zmaw.de/embedded/cdo/1.5.4/cdo.html#x1-2880002.8.6
Also, just for your info: CDO mean and average calculations are slightly different, depends on the input data (this applies to all operators involving "mean" or "avg")
For more info see: https://code.zmaw.de/embedded/cdo/1.5.4/cdo.html#x1-290001.7.1
Hope this helps!
Cheers,
J.
RE: average/sum over any chosen dimension - Added by Ralf Mueller almost 13 years ago
And there is VERTSTAT for vertical operations.
RE: average/sum over any chosen dimension - Added by Erik Noble almost 13 years ago
Thank you.
One last question in the same area?
Lets say I have a file of 3-hourly rain accumulation (time, lat, lon) and I want create a 'sum' over time to create daily fields, in one file, which command can help me do this?
TIMSELSTAT? If so, how?
I have been using the following steps:
cdo splitday $FILE day_
and then
FILES=`ls day_*.nc
for i in $FILES
do
cdo timesum $i temp_$i
done
and then
cdo mergetime temp_*.nc $FILE_daily.nc
Is there a more efficient way to do this with one command?
-Erik
RE: average/sum over any chosen dimension - Added by Uwe Schulzweida almost 13 years ago
cdo daysum $FILE $FILE_daily.nc
RE: average/sum over any chosen dimension - Added by Sopan kurkute about 10 years ago
Very useful information. Thank you very much