Project

General

Profile

CDO takes only the first date with ifthen?

Added by sari mechal over 7 years ago

Hi All,

I have two netcdf files fil1 and fil2.

I want to assign any value in fil2 to NA if the corresponding value in fil1 < 400?

cdo -ifthen -gec,400 -select,name=VAR1 fil1.nc -select,name=VAR2 fil2.nc out.nc
the grid, period of fil1 and fil2 are the same monthly 1900 to 1950.

it worked great without error!

but I noticed in the output that CDO took the first date 01-1900 from fil1.nc and used it for the whole period of fil2.nc.

it did like this

if the value in fil1.nc 01-1900 > 400 assign NA in 01-1900 in fil2.nc
if the value in fil1.nc 01-1900 > 400 assign NA in 02-1900 in fil2.nc
if the value in fil1.nc 01-1900 > 400 assign NA in 03-1900 in fil2.nc

What I need is this:

if the value in fil1.nc 01-1900 > 400 assign NA in 01-1900 in fil2.nc
if the value in fil1.nc 02-1900 > 400 assign NA in 02-1900 in fil2.nc
if the value in fil1.nc 03-1900 > 400 assign NA in 03-1900 in fil2.nc
......... etc

Thanks