Sum of temperatures above 10 degree
Added by Bogdan Rosca over 8 years ago
Hello. I am trying to calculate the sum of temperatures above or equal to 10 degrees for each month of an interval but I did not manage to select properly only the temperatures above or equal to 10 degree. I have tried with this two commands:
cdo monsum -expr,'tsum=tmed>10' -selmon,04/09 -selyear,1961/1990 T_ave.nc of.nc
and
cdo monsum -gec,10 -selmon,04/09 -selyear,1961/1990 T_ave.nc of.nc
but in the end when I calculated the multi-year monthly means (with ymonmean) I get the same result as calculating without -expr or -gec.
Is there a way to select the temperatures above 10 degrees other than gec or gtc?
Replies (2)
RE: Sum of temperatures above 10 degree - Added by Ralf Mueller over 8 years ago
the expression tmed>10
is boolean, so what you get is a 0,1-fields out of it. The same for gtc.
the clasic solution is: Create a mask with gtc and multiply it with the data fiels before summing it up. You can do that with
cdo -monsum -mul T_ave.nc -gtc,10 T_ave.nc T_ave_count.nc
the other options is what you may wanted to achive with your first try
cdo -monsum -expr,'tsum=(tmed>=10.0)?t:0.0' T_ave.nc T_ave_count.nc
see here for more options
hth
ralf
RE: Sum of temperatures above 10 degree - Added by Bogdan Rosca over 8 years ago
Great!! Now it's all clear. That solved the problem.
Thank you.