Opened 11 years ago

Closed 11 years ago

#27 closed defect (fixed)

netcdf-4 unsupported in gdal builds

Reported by: etourigny Owned by: ubuntu@…
Component: GDAL Severity: serious
Keywords: Cc:

Description

The ubuntugis-unstable builds of gdal have a problem with netcdf-4 files (which use hdf5 storage).

The consequence is that netcdf-4 files are not supported in apps that use gdal (like qgis), because the hdf5 driver is used and it does not read dimension information of netcdf-4 files.

Long story short - proper detection of netcdf-4 support in gdal netcdf driver requires nc-config which is in netcdf-bin package - although it should be in libnetcdf-dev (these are built by ubuntu).

==> Simple fix is to add netcdf-bin as a dependency for gdal.

Long story:

netcdf-4 files use hdf5 format, but the netcdf driver should try to open them first. If the file has nc/nc2/nc4/cdf suffix, the netcdf driver tries to open the file, and if it fails then the hdf5 driver is used. Normally the netcdf driver is loaded before the hdf5 driver.

This works well on my builds, but it doesn't work with the ubuntugis builds.

I have traced the source of the problem to the build log at https://launchpadlibrarian.net/122450487/buildlog_ubuntu-oneiric-amd64.gdal_1.9.2-2~oneiric6_BUILDING.txt.gz

checking for nc-config... no
        did not find nc-config, some features may be missing
        use --with-netcdf=/path/to/netcdf or add nc-config to PATH
checking for nc_open in -lnetcdf... yes

Proper output (which I get by building the same package from source using dpkg-buildpackage)

checking for nc-config... /usr/bin/nc-config
checking libnetcdf compiler and linker flags with nc-config...
 got version="netCDF 4.1.1", prefix="/usr",
 libs="-L/usr/lib -lnetcdf", includedir="/usr/include"
checking for nc_open in -lnetcdf... yes
checking for netcdf-4 (and HDF5) support in libnetcdf... yes

The source of this error is that libnetcdf used for the build lacks nc-config.

You can try with the sample datasets in the gdal autotest : autotest/gdrivers/data/trmm-nc4.nc

with gdal-1.9.2-2 from ubuntugis-unstable (oneiric):

$ gdalinfo /data/src/gdal/svn/branches/1.9/autotest/gdrivers/data/trmm-nc4.nc Driver: HDF5Image/HDF5 Dataset Files: /data/src/gdal/svn/branches/1.9/autotest/gdrivers/data/trmm-nc4.nc Size is 40, 40

Forcing the use of the netcdf driver works (because libnetcdf does has hdf5 support):

$ gdalinfo NETCDF:/data/src/gdal/svn/branches/1.9/autotest/gdrivers/data/trmm-nc4.nc Warning 1: NetCDF driver detected file type=5, but libnetcdf detected type=3 Driver: netCDF/Network Common Data Format Files: none associated Size is 40, 40

with a custom build works out of the box :

$ gdalinfo NETCDF:/data/src/gdal/svn/branches/1.9/autotest/gdrivers/data/trmm-nc4.nc Driver: netCDF/Network Common Data Format Files: none associated Size is 40, 40

Change History (2)

comment:1 by etourigny, 11 years ago

Severity: importantserious

As gdal-1.10 has been released I would stress to please resolve this issue so that it is fixed in 1.10 release.

Simple fix is to add netcdf-bin (a very small package) as a build requirement.

Thanks

comment:2 by etourigny, 11 years ago

Resolution: fixed
Status: newclosed

it seems that recent builds of gdal-1.10 now depend on netcdf-bin, and netcdf-4 file support is builtin - thanks to whoever changed that. Closing this bug.

Note: See TracTickets for help on using tickets.