Opened 15 years ago

Closed 15 years ago

Last modified 11 years ago

#2774 closed defect (fixed)

Wrong initial value for nGCPCount in HDF5 sub-datasets

Reported by: antonio Owned by: Even 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 (4)

comment:1 by Even Rouault, 15 years ago

Owner: changed from hobu to Even Rouault

comment:2 by Even Rouault, 15 years ago

Component: PythonBindingsGDAL_Raster
Resolution: fixed
Status: newclosed
Summary: SystemError on GCPs retrieving from HDF5 sub-datasetsWrong 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

comment:3 by Even Rouault, 15 years ago

Milestone: 1.6.11.5.5

comment:4 by Even Rouault, 11 years ago

Milestone: 1.5.5

Milestone 1.5.5 deleted

Note: See TracTickets for help on using tickets.