Loading a NetCDF (raster) layer into GIS:
- For my 1-page introduction to GIS, see here.
Loading a GeoTIFF into GIS packages like QGIS or ArcGIS is straight-forward (see e.g. first few min of this video). However, not so straight-forward is how to load a NetCDF file. It's a bit fiddly, but only takes a few seconds if you follow these steps (please don't follow advice to convert a NetCDF to GeoTIFF first because that usually involves throwing away a lot of information!):
Say your NetCDF file is $FILE1 (my example here is a bit of hydrological data from Panama, in 2D variable rflow), which is a 2D grid where the spatial dimensions are called lon and lat. Now follow the instructions below for either QGIS or ArcGIS:
* Nowadays, the standard for raster layers is shifting towards the wide use of NetCDF files (which I believe will soon supplant GeoTIFF, HDF and all other forms of raster).
- For my 1-page introduction to GIS, see here.
Loading a GeoTIFF into GIS packages like QGIS or ArcGIS is straight-forward (see e.g. first few min of this video). However, not so straight-forward is how to load a NetCDF file. It's a bit fiddly, but only takes a few seconds if you follow these steps (please don't follow advice to convert a NetCDF to GeoTIFF first because that usually involves throwing away a lot of information!):
Say your NetCDF file is $FILE1 (my example here is a bit of hydrological data from Panama, in 2D variable rflow), which is a 2D grid where the spatial dimensions are called lon and lat. Now follow the instructions below for either QGIS or ArcGIS:
* Nowadays, the standard for raster layers is shifting towards the wide use of NetCDF files (which I believe will soon supplant GeoTIFF, HDF and all other forms of raster).
Problem 1: layer does not appear over Panama, but very large at a location with the NW corner fixed at a location in the ocean south of Ghana (this is called Null Island)
|
Problem 2: layer does not appear over Panama, but very tiny at a location in the ocean south of Ghana (this is called Null Island)
|
Got it right: layer is positioned over Panama.
|
QGIS: Open up a blank, default global map in QGIS ("New Empty Project"). Right-click in the middle -> Copy Coordinate, you will see that the Map CRS is EPSG:4326. Now, you have two options:
(OPTION 1) SET THE PROJECT CRS TO A GCS (e.g. EPSG:4326) and make all imported layers conform to that: - Go to Settings -> Options and you will see 2 options for the project: Change it from "Use CRS from first layer added" to "Use a default CRS" and set the default to EPSG:4326. Also, change "CRS for Layers" to be "Use project CRS". - Layer -> Add Layer -> Add XYZ Layer -> XYZ Connections -> OpenStreetMap -> Add -> Close - Layer -> Add Layer -> Add Raster Layer ... -> Put $FILE1 as the Raster Dataset -> Leave HONOUR_VALID_RANGE, IGNORE_XY_AXIS_NAME_CHECKS, VARIABLES_AS_BANDS, ASSUME_LONGLAT and PRESERVE_AXIS_UNITS_IN_CRS as <Default> -> Add. A list of variables will appear: select rflow -> Close. If the layer appears, but enormously large with the NW corner on Null Island (see Problem 1 above), this is most likely because your file does not have dimension variables (i.e. the spatial axes are just values 1,2,3,... and do not have any 'dimension variable' telling QGIS what these mean, e.g. 53.5, 54.0, 54.5, ... degE, so you need to generate that dimension variable (e.g. as I have to do for JULES output data)). - Right-click the $FILE1 layer -> Properties -> Symbology -> Band rendering -> Change the render type to "Singleband pseudocolor" and change the Color Ramp to "Turbo". - Select Plugins -> Manage and Install Plugins… -> Search for RasterTimeseriesManager -> Install. Now you can click play on the time controls above the main map. (OPTION 2) SET THE PROJECT CRS TO A PCS (e.g. EPSG:3857) and make all imported layers conform to that: - Go to Settings -> Options and you will see 2 options for the project: Change it from "Use a default CRS" to "Use CRS from first layer added". Also, change "CRS for Layers" to be "Use project CRS". - Layer -> Add Layer -> Add XYZ Layer -> XYZ Connections -> OpenStreetMap -> Add -> Close. Right-click in the middle -> Copy Coordinate, you will see that the Map CRS has changed to EPSG:3857. - Layer -> Add Layer -> Add Raster Layer ... -> Put $FILE1 as the Raster Dataset -> Leave HONOUR_VALID_RANGE, IGNORE_XY_AXIS_NAME_CHECKS, VARIABLES_AS_BANDS, ASSUME_LONGLAT and PRESERVE_AXIS_UNITS_IN_CRS as <Default> -> Add. A list of variables will appear: select rflow -> Close. Your layer should appear as a very tiny layer (see Problem 2 above). Now go to the Processing Toolbox (right) and open tool GDAL -> Raster projections -> Warp (reproject) -> Put $FILE1 as the Input Layer, source CRS as EPSG:4326, target CRS as EPSG:3857 (i.e. the map projection) -> Run -> Close -> The new layer "Reprojected" will be correctly aligned with OpenStreetMap. Right-click on new layer "Reprojected" and rename to something more similar to the name of $FILE1. - Right-click the $FILE1 layer -> Properties -> Symbology -> Band rendering -> Change the render type to "Singleband pseudocolor" and change the Color Ramp to "Turbo". - Select Plugins -> Manage and Install Plugins… -> Search for RasterTimeseriesManager -> Install. Now you can click play on the time controls above the main map. By following options (1) or (2), you can get the layer displayed correctly (see 'Got it right' above), but the project CRS is different in (1) and (2). All other things being equal, I find (1) more straight-forward, so that's what I use, but I suspect surveyors would prefer (2). |
ArcGIS: Instructions to come, but essentially you use Multidimension Tools.
|