5

Background:

At 3.14.16, using the 64-bit network installer, under Windows 10, I am unable to load any NetCDF files.

For example, this instructional blog post:

https://opengislab.com/blog/2020/10/10/wind-vector-mapping-and-animation-in-qgis

has a link to its sample netCDF data

I have unsuccessfully attempted to load this .nc file using the following procedures:

  1. Drag & drop the file from Windows File Explorer into QGIS
  2. Layer > Add Layer > Add Mesh Layer...
  3. From the QGIS Browser Panel

In every case, QGIS responded that the netCDF file was "...not a valid or recognized data source.", as shown in this screenshot:

enter image description here

Efforts to find a solution:

  1. I confirmed that the downloaded NetCDF file is valid using gdalinfo filename.nc. Although the output is too long to paste here, nothing in it indicated any sort of data error. Here are the first 5 lines:

Driver: netCDF/Network Common Data Format
Files: roms_hiig_e366_7434_fd44.nc
Size is 512, 512
Coordinate System is `'
Metadata:

  1. Confirmed that the gdal version supports netCDF, using gdalinfo --formats. The results show that the netCDF format is supported:

Supported Formats:
...
netCDF -raster,vector- (rw+s): Network Common Data Format
...

  1. Conducted an OSGeo4W Advanced Install and enabled all netCDF-related utilities and libraries; the results shown in this screenshot:

enter image description here

Problem:

Despite my attempts, QGIS will still not load any .nc files, responding every time that they are not a valid or recognized data source. What am I missing?

Update:

Using 2.18.28 I am able to successfully load the raster versions of the .nc file, but not the mesh versions. Still no success with either raster or mesh versions at 3.14.16.

Update #2:

Although QGIS will not allow me to load the netCDF file at all, I am particularly interested in accessing the mesh netCDF data, not the raster version. The screenshot below (taken from Cyril Mikhalchenko's answer) of a netCDF file in QGIS shows the mesh data outlined in red. Note that the mesh data has a different icon than the raster data.

enter image description here

6
  • Thanks, but still fails... I've tried dragging and dropping from/to every possible source/destination. P.S. what do you mean by "resurrection"?
    – Stu Smith
    Commented Oct 12, 2020 at 19:33
  • I have tested the behavior in QGIS 3.6 and I get a download if 2 files are in the free space of the folder... I can save them and give you a link... Commented Oct 12, 2020 at 19:38
  • 1
    "raster versions of the .nc file, but not the mesh versions", what do you mean by mesh versions? Does gdalinfo list those other things? What layers do you know in the file? Commented Oct 14, 2020 at 6:09
  • 1
    Have you tried using "Layer > Add Layer > Add Mesh Layer..."? That works for me in the lates version. Sorry but it was not clear before that you really actually meant mesh data and that such data is included in the file. Commented Oct 18, 2020 at 19:43
  • 1
    Yes, @bugmenot123 I covered ... > Add Mesh Layer.... in the OP. Thanks for your continued interest in my problem. Sorry if my original question was unclear about the mesh being my ultimate goal. Even so, I am still unable to add any .nc file, either raster or mesh :(
    – Stu Smith
    Commented Oct 18, 2020 at 20:07

4 Answers 4

1

Works for me in QGIS 3.16 on MacOS

enter image description here

I downloaded the file directly from the link in your post, did a Layer/Add Mesh Layer, chose the default and zoomed to layer.

Further, I chose the velocities as a vector field under Layer/Properties, zoomed in and identified a point, and enabled the temporal controller:

enter image description here

0

"Mesh" can mean different things in different contexts or disciplines. In this case and to QGIS the is a raster, not a mesh.

You can load it using Layer > Add Layer > Add Raster Layer...

5
  • Unfortunately Layer > Add Layer > Add Raster Layer... also fails to load the .nc file, with this error: "Invalid Layer: GDAL provider cannot open GDAL dataset ... not recognized as a supported file format"
    – Stu Smith
    Commented Oct 12, 2020 at 19:20
  • 1
    It works for me in QGIS 3.14. Are you sure that the GDAL you used to inspect the file on the commandline is the same GDAL that your QGIS uses? Sounds like your QGIS is lacking netCDF support. Commented Oct 13, 2020 at 16:15
  • when you say it "...works for me..." what do you mean? Did you simply drag&drop the .nc file into QGIS, or did you use some other method? What results were displayed? Regarding my QGIS lacking netCDF, you'll note in my OP that I (hopefully) confirmed that netCDF support existed.
    – Stu Smith
    Commented Oct 13, 2020 at 22:32
  • I did do exactly what my answer says. I then could choose one of four "layers" and looked at them. Commented Oct 14, 2020 at 6:08
  • 2
    The file linked in the Q will open as a Layer/Add layer/Add Mesh Layer, with extra capabilities versus a raster file. For example QGIS can treat the u and the v variables as components of velocity.
    – Dave X
    Commented Nov 18, 2020 at 1:35
0

So, the following situation occurred with your file in QGIS version 3.6.

  1. I downloaded the file and defined it on disk D, in the root folder in free space;
  2. I then dragged it to the layer browser, see the figure below;

enter image description here

  1. Since your file was grouped, when unloading QGIS using the GDAL library, automatically renamed the files with invalid syntax, i.e. colon - ":" and quotes - " " " appeared in the file names, see the figure above;
  2. I then saved each individual file with the renaming, replacing the ":" and " with "_";
  3. After these actions, the files are in order, a link to the files: https://drive.google.com/file/d/1ua3kEIuNFNSmyypXCa73KBz3UN7JMKdj/view?usp=sharing

Conclusion: I assume that the problems are related to the system behavior when automatically renaming grouped files, perhaps something else...

Edit:

For the sake of the experiment, I added a file in the format netCDF of a screenshot, see below

enter image description here

In my hands, any geodata "comes to life" ... this is a joke

Translated with www.DeepL.com/Translator (free version)

7
  • Thanks, Cyril, for making the files available. However, your files only contain the .tif file versions, not the netCDF files. Thus I still am unable to view the .nc files.
    – Stu Smith
    Commented Oct 13, 2020 at 23:00
  • Also, in your screenshot you are displaying the raster file versions, not the mesh file versions. I need the mesh versions.
    – Stu Smith
    Commented Oct 13, 2020 at 23:54
  • Unfortunately, I'm not a raster data expert, so wait for the expert to answer...can't you use the GDAL library to convert GeoTiff to NETCDF? Commented Oct 14, 2020 at 9:17
  • They could maybe, but that is not the topic of this question ;) Commented Oct 14, 2020 at 12:39
  • Cyril, I see from your edit that you have loaded the mesh data. Congratulations! That is exactly what I need to do, but am unable.
    – Stu Smith
    Commented Oct 17, 2020 at 15:42
0

The NetCDF should be possible to load with any of the mentioned workflows as QGIS Mesh Layer. As it works on macOS, it is likely Windows-specific bug related to different versions of the packaged libraries or other similar problems. There were many bug fixes for Mesh Layer related to NetCDF for QGIS 3.18 version. I suggest trying install QGIS 3.18 with both old and new installer (they have different libraries packaged). If the problem persists, please open ticket on issue tracker and the QGIS team will fix it for the next releases

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.