Is there any CDO or NCO function to truncate netCDF values?

181 Views Asked by At

I am dealing with slight negative values (after de-accumulate a cumulative precipitation array), which I suppose are numerical artifacts due to precision, and I want to truncate all values x<0 and assign them as 0.

Is there any function to truncate values in CDO/NCO? I cannot find them.

Many thanks in advance!

1

There are 1 best solutions below

0
Charlie Zender On BEST ANSWER

A concise way to truncate is with ncap2's clipping operator >> documented here:

ncap2 -s 'precip = precip >> 0' in.nc out.nc