masking with 0 values
Added by kunal bali over 5 years ago
Dear CDO users,
I have one global file ( e.g. modis.nc ) with some values (e.g AOD ) . Now I want to assign 0 values in one country/shapefile (e.g India) in that global file. So how can I mask 0 values in Indian region.
if I have two files such as
1.) global.nc
2.) shape file in NetCDF ==> India1.nc
so how can we proceed.
regards
kunal
Replies (2)
RE: masking with 0 values - Added by Uwe Schulzweida over 5 years ago
1. Create a mask with 0/1 from your "shapefile" and enlarge this field to the size of the global modis data:
cdo -remapnn,modis.nc -setmisstoc,1 -eqc,0 india1.nc mask.nc2. Multiply this mask with the modis data:
cdo mul modis.nc mask.nc result.ncYou can combine these commands to:
cdo mul modis.nc -remapnn,modis.nc -setmisstoc,1 -eqc,0 india1.nc result.nc