Project

General

Profile

Select positive values only

Added by Almami Johnson about 6 years ago

Dear All

I'm just wondering how to select positive values only from an input file and save them in an output file while putting all negative values to 0.

Thanks.


Replies (2)

RE: Select positive values only - Added by Uwe Schulzweida about 6 years ago

Try the CDO operator setrtoc:

    setrtoc   Set range to constant
                       / c      if i(t,x) GE rmin AND i(t,x) LE rmax
              o(t,x) = 
                       \ i(t,x) if i(t,x) LT rmin AND i(t,x) GT rmax
Syntax:
    setrtoc,rmin,rmax,c  ifile ofile
Example:
   cdo setrtoc,-1.e99,0,0 ifile ofile

RE: Select positive values only - Added by Almami Johnson about 6 years ago

It works perfectly. Many thanks.

    (1-2/2)