[gdal-dev] Cannot read NetCDF subdatasets

Paolo Corti pcorti at gmail.com
Wed Jun 20 01:47:20 PDT 2012


On Tue, Jun 19, 2012 at 7:48 PM, Etienne Tourigny
<etourigny.dev at gmail.com> wrote:
> no... unless your system uses the hdf5 driver before the netcdf driver.
>
> If the netcdf driver detects a hdf5 file that ends with nc, nc2, nc4
> or cdf (the common extensions) then it opens it, else it passes it to
> the hdf5 driver.
> There is no other way of identifying hdf5 files that are not "netcdf-4" files.
>
> There is a test in the autotest suite that tests that the netcdf
> driver picks up netcdf-4 files but not other hdf5 files. If you do
> have the autotests installed, try to run the gdrivers/netcdf.py test.
>
> Can you send an example file to me?
>
>

The system, when opening the whole dataset uses hdf5 as the default.
At least, gdalinfo  display the list of each subdataset like this:

....
Subdatasets:
  SUBDATASET_1_NAME=HDF5:"/effisRisk/Data/Season-2012/Ecmwf/m05/Glb_20120528.nc4"://cf_DangerRisk
  SUBDATASET_1_DESC=[10x640x1280] //cf_DangerRisk (32-bit floating-point)
  SUBDATASET_2_NAME=HDF5:"/effisRisk/Data/Season-2012/Ecmwf/m05/Glb_20120528.nc4"://cf_FWI
  SUBDATASET_2_DESC=[10x640x1280] //cf_FWI (32-bit floating-point)
....

When opening a subdatset it uses the netcdf as the default
If I specify NETCDF:dataset it correctly uses netcdf also for the whole dataset.

Tests run fine, this is the output:

# python netcdf.py
/usr/lib/python2.4/site-packages/GDAL-1.9.0-py2.4-linux-i686.egg/osgeo/gdal.py:80:
DeprecationWarning: gdal.py was placed in a namespace, it is now
available as osgeo.gdal
  DeprecationWarning)
  TEST: netcdf_1 ... NOTICE: using netcdf version 4.1.3  has_nc2: True
 has_nc4: False
success
  TEST: netcdf_2 ... success
  TEST: netcdf_3 ... success
  TEST: netcdf_4 ... success
  TEST: netcdf_5 ... success
  TEST: netcdf_6 ... success
  TEST: netcdf_7 ... success
  TEST: netcdf_8 ... success
  TEST: netcdf_9 ... success
  TEST: netcdf_10 ... success
  TEST: netcdf_11 ... success
  TEST: netcdf_12 ... success
  TEST: netcdf_13 ... success
  TEST: netcdf_14 ... success
  TEST: netcdf_15 ... success
  TEST: netcdf_16 ... skip
  TEST: netcdf_17 ... skip
  TEST: netcdf_18 ... skip
  TEST: netcdf_19 ... skip
  TEST: netcdf_20 ... skip
  TEST: netcdf_21 ... skip
  TEST: netcdf_22 ... skip
  TEST: netcdf_23 ... skip
  TEST: netcdf_24 ... success
  TEST: netcdf_25 ... success
  TEST: netcdf_26 ... success
  TEST: netcdf_27 ... success
  TEST: SetGeoTransform: byte.tif ... success
  TEST: SetProjection: byte.tif ... success
  TEST: CreateCopy: byte.tif ... success
  TEST: Create: byte.tif ... success
  TEST: SetNoDataValue: byte.tif ... success
  TEST: CreateCopy: byte_signed.tif ... success
  TEST: Create: byte_signed.tif ... success
  TEST: SetNoDataValue: byte_signed.tif ... success
  TEST: CreateCopy: int16.tif ... success
  TEST: Create: int16.tif ... success
  TEST: SetNoDataValue: int16.tif ... success
  TEST: CreateCopy: int32.tif ... success
  TEST: Create: int32.tif ... success
  TEST: SetNoDataValue: int32.tif ... success
  TEST: CreateCopy: float32.tif ... success
  TEST: Create: float32.tif ... success
  TEST: SetNoDataValue: float32.tif ... success
  TEST: CreateCopy: float64.tif ... success
  TEST: Create: float64.tif ... success
  TEST: SetNoDataValue: float64.tif ... success

Test Script: netcdf
Succeeded: 39
Failed:    0 (0 blew exceptions)
Skipped:   8
Expected fail:0

I will send you the link to download a test dataset off list.
cheers
p

-- 
Paolo Corti
Geospatial software developer
web: http://www.paolocorti.net
twitter: @capooti
skype: capooti


More information about the gdal-dev mailing list