3

Despite the topic Cannot open NetCDF File in QGIS, I cannot properly visualize my NetCDF file (nc4) in QGIS. It is quite strange because Panoply can do this (see image below). My NetCDF file visualize Standardized Precipitation Index (there are many results for the region of interest). It seems to me that I am able only to visualize it in some strange very narrow line if I loaded as raster.

This really doesn't help:

 Layer > Add Layer > Add Mesh Layer.

Error message:

Invalid Data Source: C:\Users\lukat\Downloads\IMERG_spi_gamma_03.nc is not a valid or recognized data source.

Panoply result

11
  • What version of netCDF is your data? Version <=3 and 4 are different in their internal structure. Jun 9 '20 at 11:47
  • Format of the file is nc4 Jun 9 '20 at 12:10
  • Do you have GDAL installed alongside with QGIS (e.g. via osgeo4w)? If so, what does gdalinfo say about the file? Jun 9 '20 at 13:31
  • 1
    I may be wrong, but if you are trying to follow this NASA training course material material by Amita Mehta and Sean McCartney, you will find how to fix your very narrow line on the slide# 31 .
    – Kazuhito
    Jun 11 '20 at 1:00
  • 1
    @Kazuhito Great! It is working! I've skipped this part because I've thought that I've already done it before, however It is little bit different. approach. So yes, You need to change the order of lat, lon and time. Thank you! Jun 12 '20 at 8:56
5

I've solved my issue with the help of @Kazuhito.

Firstly, you need to install the NCO (netCDF Operator). The issue is that NetCDF has sometimes different order of variables and QGIS is not able to recognize and match right variables (so it is reading time as longitude).

The NCO command as follows should change variables to the right order for QGIS:

ncpdq -a time,lat,lon IMERG_spi_gamma_03.nc spi_gamma_03_mozambique.nc 
4
  • please mark your own answer as the solution ✅ Jun 16 '20 at 8:41
  • How do I install the "NCO"? Do I download it from some web source? I couldn't find it in the QGIS plugin repository.
    – Stu Smith
    Sep 24 '20 at 17:58
  • The NCO is best to obtain through the Anaconda distribution ;-) Oct 2 '20 at 15:26
  • To get NCO, if you already have conda, enter this into the command line: conda install -c conda-forge nco
    – Beardsley
    Jan 30 '21 at 0:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.