netcdftruncatecdo-climatenco

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


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!


Solution

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

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