Mike,

there are a number of situations where you can get a Dataset not linked to a driver. Code expecting a Dataset as input should be robust to it having a null driver.

In your situation, given that small_world.tif is a multiband dataset, but AsMDArray().AsClassicDataset() returning a single band one, having GetDriver() report the GTiff driver would not match the expectation that if Dataset.GetDriver() returns a non null pointer ,then Dataset.GetDescription() can be passed to GDALOpen() and returns a dataset that is identical to it.

Even

Le 22/07/2025 à 05:04, Michael Sumner via gdal-dev a écrit :
Hi, this is new to me -  casting from MDIM results in a dataset with a null driver:

ds = gdal.Open("../gdrivers/data/small_world.tif")
ds.GetRasterBand(1).AsMDArray().AsClassicDataset(0,1).GetDriver()

(stupid question:   )
It makes sense to me for GTiff which has no MDIM capability, but how then does the work get done?

I noticed by going from truly MDIM netcdf to AsClassicDataset() - I'd expected that the NetCDF driver was still involved.

Does this mean we just have to test for null driver and report <none> in that case generally?

Thanks, Mike




--
Michael Sumner
Ordinary Member,  Streets People Love Hobart Association
Research Software Engineer
Australian Antarctic Division
Hobart, Australia
0438489030
e-mail: mdsum...@gmail.com

_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev

--
http://www.spatialys.com
My software is free, but my time generally not.
_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to