Cannot open NetCDF File in QGIS
I downloaded the nc file. I check it with gdalinfo (from gdal utilities):
gdalinfo Dec-Levels.nc
Driver: netCDF/Network Common Data Format
Files: Dec-Levels.nc
Size is 512, 512
Coordinate System is `'
Metadata:
NC_GLOBAL#Conventions=CF-1.6
NC_GLOBAL#history=2018-12-10 17:18:38 GMT by grib_to_netcdf-2.9.2: grib_to_netcdf /data/data03/scratch/50/46/_mars-atls00-a562cefde8a29a7288fa0b8b7f9413f7-X9jE61.grib -o /data/data05/scratch/5e/f4/_grib2netcdf-atls18-70e05f9f8ba4e9d19932f1c45a7be8d8-eDzoQH.nc -utime
Subdatasets:
SUBDATASET_1_NAME=NETCDF:"Dec-Levels.nc":z
SUBDATASET_1_DESC=[124x4x121x161] geopotential (16-bit integer)
SUBDATASET_2_NAME=NETCDF:"Dec-Levels.nc":t
SUBDATASET_2_DESC=[124x4x121x161] air_temperature (16-bit integer)
SUBDATASET_3_NAME=NETCDF:"Dec-Levels.nc":q
SUBDATASET_3_DESC=[124x4x121x161] specific_humidity (16-bit integer)
SUBDATASET_4_NAME=NETCDF:"Dec-Levels.nc":w
SUBDATASET_4_DESC=[124x4x121x161] lagrangian_tendency_of_air_pressure (16-bit integer)
SUBDATASET_5_NAME=NETCDF:"Dec-Levels.nc":r
SUBDATASET_5_DESC=[124x4x121x161] relative_humidity (16-bit integer)
SUBDATASET_6_NAME=NETCDF:"Dec-Levels.nc":u
SUBDATASET_6_DESC=[124x4x121x161] eastward_wind (16-bit integer)
SUBDATASET_7_NAME=NETCDF:"Dec-Levels.nc":v
SUBDATASET_7_DESC=[124x4x121x161] northward_wind (16-bit integer)
Corner Coordinates:
Upper Left ( 0.0, 0.0)
Lower Left ( 0.0, 512.0)
Upper Right ( 512.0, 0.0)
Lower Right ( 512.0, 512.0)
Center ( 256.0, 256.0)
It looks OK. Then I load all layers (seven layers) into QGIS 3.12 without any error:
I suppose your file had some defect during downloading. Test the downloaded file with gdalinfo (you can start it for osgeo4w shell window). You should also check in case of error if your gdal version supports netCDF:
gdalinfo --formats
Supported Formats:
VRT -raster- (rw+v): Virtual Raster
DERIVED -raster- (ro): Derived datasets using VRT pixel functions
GTiff -raster- (rw+vs): GeoTIFF
... very log list ...
netCDF -raster,vector- (rw+s): Network Common Data Format
...
I tested on Ubuntu 18.04 Linux, gdal 2.2.3 and QGIS 3.12.1
As stated in the linked thread, QGIS (3.2+) can open the NetCDF file as a mesh layer.
(1) Open the file using Layer > Add Layer > Add Mesh Layer
.
(2) By default, the first variable (Geopotential_level:250) will be plotted. Below is a short note to To view the variable you need.
- Open the Layer Properties (by right-clicking on the
Dec-Levels
layer on the Layers panel). - On the Symbology tab, double click on the grey area at the right-hand-side of the desired variable to change it to rainbow square. You can also change the date/time by a slidebar/pulldown menu.
Then click on [OK] or [Apply] button.