Project

General

Profile

select range of value

Added by Nurul Ain almost 3 years ago

hello, is it possible to select range of value from a file? for instance, i want 1-10 only?

so the file from 1 2 45 3 2 41 65 10 3 7 98 6 2

will become 1 2 3 2 10 3 7 6 2


Replies (2)

RE: select range of value - Added by Karin Meier-Fleischer almost 3 years ago

Hi Nurul,

have a look at the documentation https://code.mpimet.mpg.de/projects/cdo/embedded/cdo.pdf#subsection.2.6.15. Search for range and you'll find it.

The operator setvrange sets the range of the value. It selects all data within the range and set all others to missing_value.

cdo -setvrange,vmin,vmax infile outfile

-Karin

RE: select range of value - Added by Nurul Ain almost 3 years ago

thank you karin, can i ask if i can do this kind of analysis in cdo?

to find the consecutive value below -1
2.0 2.5 2.1 1.3 1.4 -1.0 -2.1 -1.2 -1.5 -2.1 2.0 3.2 3.0 -1.0 -4.0 -2.1 -1.45 -1.20 -2.0 3.0 2.5 1.2

the first consecutive negative value is categorize as first event and second consecutive negative value is the second event,

then i want to calculate the mean value for each event;
sum of -1.0 -2.1 -1.2 -1.5 -2.1, divide by 5, as there are 5 num of -ve value for first event,

and the second event,
sum of -1.0 -4.0 -2.1 -1.45 -1.20 -2.0, divide by 6, as the are 6 num of -ve value for second event

can i do this in cdo?

    (1-2/2)