Strange behaviour masking (cdo mul)
Added by Matthias Demuzere over 8 years ago
Hi all,
I just bumped into a strange masking behaviour.
Basically I have two files:
- an input file in.nc
- a mask file 1_GHCN_mask_noAnt.nc (1 for land, missing data for ocean)
Both are on the same grid.
The idea is to mask in.nc with the 1_GHCN_mask_noAnt.nc:
cdo mul /media/Matthias_2/data/cmip5/griddata/1_GHCN_mask_noAnt.nc in.nc out.nc
Although Antartica is fully masked out in the mask, I still get zeros in the out.nc?
Though I would like to have all nan-areas in mask being nans in out.nc
I have used this before for other variables, and I never had this issue?
Seems to be so that 0 * NaN = 0? Is this right?
And if so, how can I deal with this?
Please note that zero's may occur over the land pixels, so these should be kept in the out.nc file.
Thanks!
M.
025_GHCN_mask_noAnt.nc (3.97 MB) 025_GHCN_mask_noAnt.nc | |||
in.nc (262 KB) in.nc |
Replies (4)
RE: Strange behaviour masking (cdo mul) - Added by Ralf Mueller over 8 years ago
Matthias Demuzere wrote:
Hi all,
[...]I have used this before for other variables, and I never had this issue?
Seems to be so that 0 * NaN = 0? Is this right?
yes, it is, documented on page 16 of the pdf-docu or here (first 2 paragraphs)
And if so, how can I deal with this?
you could
- use the
ifthen
operator or - use zeros in your mask and do div instead of mul. this created missing values in the results field
hth
ralf
RE: Strange behaviour masking (cdo mul) - Added by Matthias Demuzere over 8 years ago
Hi Ralph,
Thanks! The ifthen option is indeed a nice one ...
I'll go with that!
Cheers,
M.
RE: Strange behaviour masking (cdo mul) - Added by Ralf Mueller over 8 years ago
RE: Strange behaviour masking (cdo mul) - Added by Ralf Mueller over 8 years ago
you could also use the recent features of the expr
operator