Project

General

Profile

Help extracting the infon mean

Added by Álvaro Sánchez over 3 years ago

Hello cdo fellas
I'am strugling doing the average value for my file, and I realized that this is already done when I saw cdo infon and the mean value for my variable is already there for each timestep, the question now is, how can I take it from there?
Thank you very much :)


Replies (4)

RE: Help extracting the infon mean - Added by Karin Meier-Fleischer over 3 years ago

Hi Alvaro,

if you want to compute the mean value from a variable on a horizontal grid per timestep you can use the operator fldmean.

cdo -fldmean infile outfile

Maybe you should extract the variable first

cdo -fldmean -selname,variable infile outfile

-Karin

RE: Help extracting the infon mean - Added by Álvaro Sánchez over 3 years ago

Hi Karin Thank you very much for your answer :)
and what does this mean?
cdo fldmean (Warning): Using constant grid cell area weights for variable tmax!
because in some .nc that I have to use the data comes from observations and it happens to be enough NaN to use avg instead of mean, but for the avg option it seems that that warning makes the operator useless. Is this possible or I'm missing everythin (which could be because I'm novel at cdo)
Thank you very very much:)

RE: Help extracting the infon mean - Added by Karin Meier-Fleischer over 3 years ago

It's hard to say why this warning occurs without the data file. I guess that the data file contains more than one variable and tmax is not the first inside. In most cases you can prevent this warning by selecting the wanted variable as explained above with selname operator.

If you want to calculate the field mean without weights you can use

cdo fldmean,weights=FALSE infile outfile

About the difference of avg and mean:

mean(1,2,3,miss) = (1+2+3)/3      = 2
mean(1,2,3,0)    = (1+2+3+0)/4    = 1.5

avg(1,2,3,miss)  = (1+2+3+miss)/4 = miss
avg(1,2,3,0)     = (1+2+3+0)/4    = 1.5

What you can do is to set the NaNs or missing values to 0, compute the mean and then set 0 back to missing value.

E.g. if you have NaNs

cdo -setmissval,0.0 -setmissval,nan ifile tmp1
cdo -fldmean -selname,variable tmp1 tmp2
cdo -setctomiss,0.0 tmp2 ofile

RE: Help extracting the infon mean - Added by Álvaro Sánchez over 3 years ago

Aaaaaah ok ok thank you very much :))))))
Now that I can, could you tell me the difference between conservative and non-conservative remapping? Is remapnn and remapbil conservative?

    (1-4/4)