Project

General

Profile

how to apply a time-varying mask to a file with multiple variables ?

Added by Guillaume S almost 5 years ago

Hello,

I am trying to apply a mask (0 and 1) with 3 dimensions (lon lat time) to a file with multiple variables (same dimensions as the mask file).

I use the "ifthen" operator. If I select a variable (with selname), everything works fine, but if I try to apply the mask to all the variables at once, I get:

"cdo ifthen: Filling up stream1 >file_mask.nc< by copying the first record."

And only the first timestep of the mask is applied to entire file. How can I manage to apply the 3D mask correctly to all the variables at once ? Thanks !

Guillaume


Replies (4)

RE: how to apply a time-varying mask to a file with multiple variables ? - Added by Ralf Mueller almost 5 years ago

hi!

Please upload all input data for further analysis. you can also multiply or divide by a mask (division by zero results in missing value)

cheers
ralf

RE: how to apply a time-varying mask to a file with multiple variables ? - Added by Guillaume S almost 5 years ago

Thanks for the "div" advise, it works as expected with this operator.

The warning is a bit different compared to "ifthen" (not the same stream number):

cdo div: Filling up stream2 >file_mask.nc< by copying the first variable of each timestep.

Perhaps it can give a clue about the problem behind ?

Guillaume

RE: how to apply a time-varying mask to a file with multiple variables ? - Added by Ralf Mueller almost 5 years ago

hi G!

If you do arithmetic operations on data CDO expects the same number of records per input file, but masks are ofthen time-independant. In that case CDO uses the same mask-data for all input timesteps or levels. It fills the needed records with the only one it can find in the mask file.

hth
ralf

RE: how to apply a time-varying mask to a file with multiple variables ? - Added by Guillaume S over 4 years ago

With a "little" delay, please find attached some data to illustrate the strange behavior:

cdo ifnotthen msk.nc var.nc var_msk.nc -> does not work properly (only the first timestep is considered)

cdo ifnotthen msk.nc -selname,socurlt_flt var.nc selvar_msk.nc -> works as expected

I still use "div" operator for now and my cdo version is 1.9.7.1. Thank you !

Guillaume

    (1-4/4)