[gdal-dev] netCDF multi-dimensional support

Stefan Blumentrath Stefan.Blumentrath at nina.no
Wed Feb 2 00:21:06 PST 2022


Hi Simon,

I am having a similar issue.
My workaround has been to deactivate HDF5 (4) driver which hides the netCDF driver.
On the command line, you could do:
gdalinfo -if netCDF file.nc

In Python:
for dreiver in ["HDF5", "HDF5Image"]:
    if gdal.GetDriverByName(driver):
        gdal.GetDriverByName(driver).Deregister()

nc_ds = gdal.Open(<file.nc>)

Hope that helps.

Cheers
Stefan

From: gdal-dev <gdal-dev-bounces at lists.osgeo.org> On Behalf Of Simon Eves
Sent: torsdag 9. desember 2021 20:33
To: gdal dev <gdal-dev at lists.osgeo.org>
Subject: [gdal-dev] netCDF multi-dimensional support

I am trying to build GDAL 3.4.0 with "full" netCDF support, but getting different results on my two machines, both Ubuntu 20.04 with supposedly-the-same dev environment.

Both have the libnetcdf-dev (4.7.3) apt package installed, and both have working nc-config, which reports the same thing on both.

I am configuring GDAL as follows:

./configure --prefix=$PREFIX --without-geos --with-libkml=$PREFIX --with-proj=$PREFIX --with-libtiff=internal --with-geotiff=internal --with-netcdf=yes

Both configure logs attached.
____________________________________________________________________

OLD (works)

$ apt list --installed | egrep -i "hdf|cdf"
hdf5-helpers/focal,now 1.10.4+repack-11ubuntu1 amd64 [installed,automatic]
libhdf4-0-alt/focal,now 4.2.14-1ubuntu1 amd64 [installed,automatic]
libhdf4-alt-dev/focal,now 4.2.14-1ubuntu1 amd64 [installed,automatic]
libhdf5-103/focal,now 1.10.4+repack-11ubuntu1 amd64 [installed,automatic]
libhdf5-cpp-103/focal,now 1.10.4+repack-11ubuntu1 amd64 [installed,automatic]
libhdf5-dev/focal,now 1.10.4+repack-11ubuntu1 amd64 [installed,automatic]
libnetcdf-dev/focal,now 1:4.7.3-1 amd64 [installed,automatic]
libnetcdf15/focal,now 1:4.7.3-1 amd64 [installed,automatic]

$ gdalinfo --formats | egrep -i "hdf|cdf"
GMT -raster- (rw): GMT NetCDF Grid Format
netCDF -raster,multidimensional raster,vector- (rw+vs): Network Common Data Format
HDF4 -raster,multidimensional raster- (ros): Hierarchical Data Format Release 4
HDF4Image -raster- (rw+): HDF4 Dataset
HDF5 -raster,multidimensional raster- (rovs): Hierarchical Data Format Release 5
HDF5Image -raster- (rov): HDF5 Dataset

$ gdalinfo file.nc<https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Ffile.nc%2F&data=04%7C01%7CStefan.Blumentrath%40nina.no%7Ca87daf95b32d40b9bba008d9bb4ac18c%7C6cef373021314901831055b3abf02c73%7C0%7C0%7C637746753705068303%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000&sdata=5IHXlLphwxKABZC18J5AzsgndUh2JqEblWAGl%2BrvH78%3D&reserved=0> | head -1
Driver: netCDF/Network Common Data Format

File imports fine
____________________________________________________________________

NEW (problematic)

$ apt list --installed | egrep -i "hdf|cdf"
hdf5-helpers/focal,now 1.10.4+repack-11ubuntu1 amd64 [installed,automatic]
libhdf5-103/focal,now 1.10.4+repack-11ubuntu1 amd64 [installed,automatic]
libhdf5-cpp-103/focal,now 1.10.4+repack-11ubuntu1 amd64 [installed,automatic]
libhdf5-dev/focal,now 1.10.4+repack-11ubuntu1 amd64 [installed,automatic]
libnetcdf-dev/focal,now 1:4.7.3-1 amd64 [installed]
libnetcdf15/focal,now 1:4.7.3-1 amd64 [installed,automatic]

$ gdalinfo --formats | egrep -i "hdf|cdf"
GMT -raster- (rw): GMT NetCDF Grid Format
netCDF -raster,vector- (rw+s): Network Common Data Format
HDF5 -raster,multidimensional raster- (rovs): Hierarchical Data Format Release 5
HDF5Image -raster- (rov): HDF5 Dataset

$ gdalinfo file.nc<https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Ffile.nc%2F&data=04%7C01%7CStefan.Blumentrath%40nina.no%7Ca87daf95b32d40b9bba008d9bb4ac18c%7C6cef373021314901831055b3abf02c73%7C0%7C0%7C637746753705068303%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000&sdata=5IHXlLphwxKABZC18J5AzsgndUh2JqEblWAGl%2BrvH78%3D&reserved=0> | head -1
Driver: HDF5/Hierarchical Data Format Release 5

Some sub-datasets will not open
____________________________________________________________________

Note that the old machine already had HDR4 libs (and consequentially GDAL built with support for that too, even though I did not explicitly reqiuest HDF4 or HDF5 support in the configure), which may be the issue, although I am loath to just install HDF4 on the new (freshly built two weeks ago) machine if I don't need to.

On the old machine, gdalinfo reports the file as netCDF just fine, and the netCDF driver claims to have multi-dimensional support. The driver on the new one does not, and the file reports as plain HDF5, and some sub-datasets will not open (presumably multi-dimensional ones!)

I am failing to find anything in the docs about the dependency chain here, or anything about having to explicitly enable multi-dimensional support in the build.

I don't know if the netCDF file in question is public-domain, so I would rather not send it to you at this time. I can find out, if that would help, although I doubt the file itself is the issue.

Please advise. Thanks! :)

Simon

--
[http://www2.omnisci.com/l/298412/2018-09-18/3sqpg/298412/61753/OmniSci_Email_Header2.png]<https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.omnisci.com%2F&data=04%7C01%7CStefan.Blumentrath%40nina.no%7Ca87daf95b32d40b9bba008d9bb4ac18c%7C6cef373021314901831055b3abf02c73%7C0%7C0%7C637746753705068303%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000&sdata=Y%2BReec5JDfSrgVI29FFg7Ftn08pW%2Fkp5w7ljw6QykCw%3D&reserved=0>
Simon Eves
Senior Graphics Engineer, Rendering Group
100 Montgomery St (5th Floor), San Francisco, CA 94104, USA
Email: simon.eves at omnisci.com<mailto:simon.eves at omnisci.com> | Cell:
+1 (415) 902-1996

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20220202/a1f98ab2/attachment.html>


More information about the gdal-dev mailing list