Project

General

Profile

Masking land values

Added by François Roberge over 6 years ago

Hi all,

I need to mask all values over nan. I have a land-sea mask that is set to 0 over the ocean and to 1 over the land. I have seen commands like this to mask the ocean :

cdo div data.nc lsm.nc masked_data.nc

However, this doesn't work in the case if I want to mask the land. I would need to "invert" the mask.

How would you mask only the land and set it to missing values?

Thank you,

François


Replies (1)

RE: Masking land values - Added by Uwe Schulzweida over 6 years ago

A workaround could be to create a new mask with subtraction of 1 and multiplication of -1:

cdo div data.nc -mulc,-1 -subc,1 lsm.nc masked_data.nc
The next CDO release comes with the new operator not (logical NOT) with produces the same result:
cdo div data.nc -not lsm.nc masked_data.nc

    (1-1/1)