I have world map GRACE-data in netcdf file. I'm looking for visualizing data in a selected region, for instance just visualize the data for Amazon or Volga basin. I was suggested to use basin mask
Asked
Active
Viewed 997 times
2 Answers
3
You could do the following if you have a shapefile of your basin.
# convert shp to nc
gdal_rasterize -of netCDF -burn 1 -tr 0.01 0.01 basin.shp basin.nc
# regrid
cdo remapbil,infile.nc basin.nc basin2.nc
# mask
cdo ifthen basin2.nc infile.nc masked_infile.nc

Dani56
- 372
- 1
- 2
- 7
-
super cool answer, I'll definitely make a note of this. – ClimateUnboxed Jul 23 '20 at 13:12
-
@Dani56 nice answer. I want to rasterize (burn) each sub-shapefile in one shapefile with a unique value for each sub-shapefile. any advice? – Alemex Dec 18 '21 at 12:22
1
If you don't need to exactly follow a basin's boundaries and are happy to simply view a "rectangle" lat-lon region, then you can also simply do
cdo sellonlatbox,lon1,lon2,lat1,lat2 world_file.nc region.nc

ClimateUnboxed
- 7,106
- 3
- 41
- 86