[Thread Prev][Thread Next][Index]

Re: [ferret_users] Re: regarding ocean basin mask / create mask from GIS shapefiles with gdal_rasterize



Hi ferreters,

NetCDF mask files can be created from GIS shapefiles with the gdal_rasterize command.
This command creates very quickly a raster image from a vector layer and is
smart enough to generate also a netcdf file.

So the different steps will be:

1) Identify a shapefile from a referenced source.
For example, http://www.marineregions.org/downloads.php#iho
for the Sea Areas defined by the International Hydrographic Organization.

2) Inspect the downloaded shapefile file with a GIS software like gqis to identify the attribute you want to export.
(show attribute table interface as described in https://docs.qgis.org/2.18/en/docs/user_manual/working_with_vector/attribute_table.html)

3) Use the gdal_rasterize command line as following:

$ gdal_rasterize -of netcdf -a ID  -te -180 -90 180 90 -tr 0.5 0.5 World_Seas.shp IHO_Sea_Areas.nc
--> will create a global netCDF file from the ID attribute at 0.5 resolution, the output variable will be named 'band1'

Then open the netCDF file from ferret:
yes? use IHO_Sea_Areas.nc
yes? shade/pal=thirty_by_levels/lev=1d band1 ; go land


The version used is:
$ gdal_rasterize --version
GDAL 1.11.3, released 2015/09/16


Regards
Patrick

--
Data Analysis and Visualization Engineer
LSCE/IPSL, CEA-CNRS-UVSQ laboratory
LSCE - Climate and Environment Sciences Laboratory
IPSL - Institut Pierre Simon Laplace
--

[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce / NOAA / OAR / PMEL / Ferret

Privacy Policy | Disclaimer | Accessibility Statement