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

  • What version of netCDF is your data? Version <=3 and 4 are different in their internal structure. Commented Jun 9, 2020 at 11:47
  • Format of the file is nc4
    – Luckasino
    Commented Jun 9, 2020 at 12:10
  • Do you have GDAL installed alongside with QGIS (e.g. via osgeo4w)? If so, what does gdalinfo say about the file? Commented Jun 9, 2020 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
    Commented Jun 11, 2020 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!
    – Luckasino
    Commented Jun 12, 2020 at 8:56

1 Answer 1


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 
  • please mark your own answer as the solution ✅ Commented Jun 16, 2020 at 8:41
  • 1
    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
    Commented Sep 24, 2020 at 17:58
  • 1
    The NCO is best to obtain through the Anaconda distribution ;-)
    – Luckasino
    Commented Oct 2, 2020 at 15:26
  • 1
    To get NCO, if you already have conda, enter this into the command line: conda install -c conda-forge nco
    – Beardsley
    Commented Jan 30, 2021 at 0:02
  • NCO website with download links: nco.sourceforge.net Still didn't work for GMRT bathymetry data though, NETCDF GMT v3 grd file.
    – dez93_2000
    Commented Jan 28, 2023 at 21:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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