Project

General

Profile

masking out ocean

Added by Nurul Ain over 3 years ago

Hi, can somebody know wht is wrong with my script?

#1. Masking out ocean (ocean will have negative values while the land values remaining the same)
cdo mul pr_CNRM-CM5_historical_SRF.nc ocean_grid.nc out1.nc
#2. Set all negative value to zero then change it to NaN
cdo setctomiss,0 -gec,0 out1.nc out2.nc
#3. Multiply the "changed NaN" to the original file to mask out the ocean
cdo subc,1 -mul -addc,1 pr_CNRM-CM5_historical_SRF.nc out2.nc pr_CNRM-CM5_historical_SRF_masked.nc


Replies (1)

RE: masking out ocean - Added by Karin Meier-Fleischer over 3 years ago

Hi Nurul,

are you getting an error message or what is wrong?

Without knowing your mask and input file I can only guess that the following will work (see https://code.mpimet.mpg.de/boards/53/topics/10933):

cdo -div pr_CNRM-CM5_historical_SRF.nc -gec,0 ocean_grid.nc pr_CNRM-CM5_historical_SRF_masked.nc

The input file and the mask file have to have the same grid.

-Karin

    (1-1/1)