[gdal-dev] python binding: error opening dataset

Ricardo Filipe Soares Garcia da ricardo.garcia.silva at gmail.com
Thu Jul 15 12:35:29 EDT 2010


Hello list

I am using the python bindings to process some hdf5 files.

I have some code that looks aproximately like this:

class TileGeorreferencer(object):
    def __init__(self, fileName, datasetName):
        self.fileName = fileName
        self.datasetName = datasetName
        self.inDriver = gdal.GetDriverByName("HDF5")
        self.inDriver.Register()
        self.outDriver = gdal.GetDriverByName("GTiff")
        self.outDriver.Register()
        self.outFileName = "%s.tif" % self.fileName
    def create_geotiff(self):
        inDs = gdal.Open('HDF5:"%s"://%s' % (self.fileName,
self.datasetName), gdal.GA_ReadOnly)
        cols = inDs.RasterXSize
        rows = inDs.RasterYSize
        originalLayer = inDs.GetRasterBand(1).ReadAsArray()
        outDs = self.outDriver.Create(self.outFileName, cols, rows, 1,
gdal.GDT_Float32)
        outBand = outDs.GetRasterBand(1)
        outBand.WriteArray(originalLayer, 0, 0)
        outBand.FlushCache()
        inDs = None
        outDs = None

t = TileGeorreferencer(filename, "LST")
t.create_geotiff()

My problem is that I can run it just fine through ipython, but when I
add it in with rest of my application I am getting this error:

"in method 'Open', argument 1 of type 'char const *'"

Thanks for helping me out.

-- 
___________________________ ___ __
Ricardo Garcia Silva


More information about the gdal-dev mailing list