Netcdf files not properly imported in QGIS

QGIS does not properly imports the netcdf files.

Here are several netcdf example files that are not correctly imported in QGIS. The only one that gets “close” to a right importing is the Sea surface temperatures file (tos_O1_2001-2002.nc).

I am trying to export a xarray.Dataset object to netcdf with the to_netcdf method in Python. The same xarray, when exported to geotiff with the to_raster method from rioxarray works fine (image inside the smaller yellow rectangle - the correct place). The gray image in the map below shows the result of importing the netcdf file generated with this Google Colab notebook.

Steps to reproduce the issue

To reproduce this error, you can:

  1. get any netcdf file from the UniData website (link posted above)
  2. get the netcdf file generated in the Google Colab notebook (also posted above)

Then you open QGIS and add the chosen netcdf file:

  1. Click on the tab Layer
  2. Scroll down to Add Layer
  3. Click on Add Raster Layer
  4. Choose your netcdf (usually .nc extension) and add it to the map

The QGIS version I used is 3.26.3.

As I don’t know where to resort to, I opened a similar topic on:

  • QGIS GitHub community issues (50660)
  • xarray GitHub community issues (7195)

Does anyone know how to come across this?

1 Like