Project

General

Profile

How to mask any region without effecting the grid resolution?

Added by Purna Durga Geesupalli over 1 year ago

Dear CDO Forum support,
I have a global .nc file. But, I wanted to pick and plot only for Indian region. When I am selecting the regions using sellonlatbox,65,100,5,40. Few ocean and other countries boarders are included in that. When I try to mask the region with one dummy file of indian shape file. Still the file remains same.

Please suggest me some way to do that.

Thank you,


Replies (2)

RE: How to mask any region without effecting the grid resolution? - Added by Karin Meier-Fleischer over 1 year ago

Hi Purna,

please, give us more information and upload the used files. Which commands did you use?

RE: How to mask any region without effecting the grid resolution? - Added by Karin Meier-Fleischer over 1 year ago

You can use the maskregion operator with the DCW country code for India. Therefore, you have to download the DCW dataset from GMT and set the environment variable DIR_DCW to the directory containing the DCW data. See https://code.mpimet.mpg.de/projects/cdo/embedded/cdo.pdf#subsection.1.5.2 section Regional regular grid: dcw:<CountryCode>[_<DXY>] __ .

Install DCW dataset:

mkdir -p $HOME/data/DCW
cd $HOME/data/DCW
wget ftp://ftp.soest.hawaii.edu/dcw/dcw-gmt-2.1.1.tar.gz
export DIR_DCW=$HOME/data/DCW/dcw-gmt-2.1.1

For this example create a file with global topography data used as input file and in the second step mask India using the maskregion operator:

cdo -f nc -topo topo.nc
cdo -sellonlatbox,67,98.5,7.5,36.5 -maskregion,dcw:IN topo.nc o.nc

    (1-2/2)