Project

General

Profile

How to create variable from first and last timestep values

Added by P Ruess over 2 years ago

I have temperature data for the Continental US. I want to pull the FIRST day of the year that is greater than or equal to 0 degrees, for all gridcells uniquely. I also want to get the LAST day of the year that is greater than or equal to 0 degrees. These should be two separate output files, with each gridcell equal to a number between 1 and 366 (days of the year), so just one slice of data for each of these two output files.

I tried following this similar question, but I don't understand exactly what to do with the "outputkey" commands: https://code.mpimet.mpg.de/boards/1/topics/7955

I created a mask, and used that mask to select only the data that is greater than 0 degrees, as follows:

cdo -gec,0 tmean_c_2008.nc tmean_c_2008_gte0mask.nc
cdo -ifthen tmean_c_2008_gte0mask.nc tmean_c_2008.nc tmean_c_2008_gte0.nc

I'm not sure where to go from here.

Any advice on how to get my desired outputs?