Ticket #2774 (closed defect: fixed)

Opened 4 years ago

Last modified 3 weeks ago

Wrong initial value for nGCPCount in HDF5 sub-datasets

Reported by: antonio Owned by: rouault
Priority: normal Milestone:
Component: GDAL_Raster Version: 1.5.2
Severity: normal Keywords: subdatasets HDF5
Cc:

Description

If I try to retrieve GCPs from a sub-datset using python bindings I get strange error. The sub-dataset has no GCP

$ gdalinfo test-subdatasets.h5
Driver: HDF5/Hierarchical Data Format Release 5
Files: test-subdatasets.h5
Size is 512, 512
Coordinate System is `'
Subdatasets:
  SUBDATASET_0_NAME=HDF5:"test-subdatasets.h5"://MBI
  SUBDATASET_0_DESC=[200x200] //MBI (8-bit unsigned integer)
  SUBDATASET_1_NAME=HDF5:"test-subdatasets.h5"://QLK
  SUBDATASET_1_DESC=[10x10] //QLK (8-bit unsigned character)
Corner Coordinates:
Upper Left  (    0.0,    0.0)
Lower Left  (    0.0,  512.0)
Upper Right (  512.0,    0.0)
Lower Right (  512.0,  512.0)
Center      (  256.0,  256.0)

so I would expect an empty tuple instead I get a SystemError exception.

In [1]: from osgeo import gdal

In [2]: ds = gdal.Open('HDF5:test-subdatasets.h5://MBI')

In [3]: ds.GetGCPs()
---------------------------------------------------------------------------
SystemError                               Traceback (most recent call last)

/home/antonio/<ipython console> in <module>()

/usr/lib/python2.5/site-packages/osgeo/gdal.py in GetGCPs(*args)
    549     def GetGCPs(*args):
    550         """GetGCPs(self, int nGCPs)"""
--> 551         return _gdal.Dataset_GetGCPs(*args)
    552
    553     def SetGCPs(*args):

SystemError: ../Objects/tupleobject.c:32: bad argument to internal function

Ubuntu 8.10 on x86_64 Python 2.5.2 GDAL 1.5.2

Test dataset: http://trac.osgeo.org/gdal/attachment/ticket/2462/test-subdatasets.h5

Change History

Changed 4 years ago by rouault

  • owner changed from hobu to rouault

Changed 4 years ago by rouault

  • status changed from new to closed
  • resolution set to fixed
  • component changed from PythonBindings to GDAL_Raster
  • summary changed from SystemError on GCPs retrieving from HDF5 sub-datasets to Wrong initial value for nGCPCount in HDF5 sub-datasets

In fact, this is not really related to the python bindings, but to the HDF5 sub-dataset object itself. The initial value of nGCPCount was -1, instead of 0.

Fixed in trunk in r16113, in branches/1.6 in r16114 and in branches/1.5 in r16115

Changed 4 years ago by rouault

  • milestone changed from 1.6.1 to 1.5.5

Changed 3 weeks ago by rouault

  • milestone 1.5.5 deleted

Milestone 1.5.5 deleted

Note: See TracTickets for help on using tickets.