Project

General

Profile

cdo commands for simple math within a file?

Added by Rainer Schneck over 8 years ago

Hi folks,

since years I miss some cdo commands that I think would be useful. Perhaps there are already good solutions, nevertheless I would like to "talk" about it.

One useful command would be "cdo recmean" to calculate the mean over all records within a file. To me it happens a lot that the normal means just can not handle my requirements.

If you want to do simple mathematics (add, sub, mul, div ...) within a file it is relatively inconvenient in the moment. E.g. if you want to add two variables that are in one file. You can try something like
cdo add -selvar,primf INFILE -selvar,secdf INFILE OUTFILE
which does not work. But even if it would work, it is relatively inconvenient. This also happens a lot e.g. if you want to sum up different fluxes.
Wouldn't it be nice we had something like "cdo addwithin"?

Viele Grüße,
Rainer


Replies (2)

RE: cdo commands for simple math within a file? - Added by Ralf Mueller over 8 years ago

Hi Rainer!

Math operations of variables within a file can be done with the expr operator. It's well documented and there are two forum threads about it, too

I do not really get your recmean suggestion

  • should be a mean value field of all variables on a certain horizontal and vertical grid in a file?
  • should be a horzontal mean, i.e. a single value
  • even a vertical mean, too?

hth
ralf

RE: cdo commands for simple math within a file? - Added by Rainer Schneck over 8 years ago

Hi Ralf,

recmean should not do a horizontal mean (the grid points shall survive). For each grid point it should mean straight over all records without differentiating variables, time steps or vertical layers. The result would be always one record. For example it could mean a file including several flux variables and several timesteps.

Viele Grüße,
Rainer

    (1-2/2)