Project

General

Profile

Selecting certain layers dependant on the value with them

Added by Lewis Dorling almost 3 years ago

I have a netcdf file which is on an hourly time step and encompasses 41 years of data.

What I would like to do is use CDO to look through the data and delete any time steps where none of the datapoints exceed a certain value.

i.e say I was only interested in time steps where there was at least 1 value above say 10, is there a way of using CDO to create a new file which only contains the time steps which have at least one datapoint with a value in excess of ten.

Thanks for the help

Lewis


Replies (3)

RE: Selecting certain layers dependant on the value with them - Added by Uwe Schulzweida almost 3 years ago

Hi Lewis,

I think it works in CDO only with the select operator and the parameter timestepmask. timestepmask is a normal data file with one field and one value per time step. The value is zero or missing for timesteps that should be removed. Here is a possibility to create such a file, if the data also have only one field per time step:

cdo gtc,-1 -fldrange datafile maskfile
cdo select,timestepmask=maskfile datafile result
Cheers,
Uwe

RE: Selecting certain layers dependant on the value with them - Added by Lewis Dorling almost 3 years ago

Hi Uwe,

thanks for the help. could you explain to me the significance of the fldrange command in the first line.

Would I not be able to achieve the same thing with just

cdo gtc,-1 inputfile outputmask

cdo select,timestepmask=maskfilee inputfile outputfile,

because as far as I understand the first line is creating a mask and replacing every data point with either a 1 or a 0 depending on my criteria
and then the second line is comparing the mask to the datafile and removing any data points that are 0.

But as I say I dont understand what the fldrange command is doing

Cheers

Lewis

RE: Selecting certain layers dependant on the value with them - Added by Uwe Schulzweida almost 3 years ago

The mask file may contain only one value per time step. fldrange reduces a field to one value, in this case the range of the field. The value is then greater than or equal to zero.

    (1-3/3)