[gdal-dev] python: possible to get Dataset from Band
even.rouault at mines-paris.org
Tue Nov 9 18:22:49 EST 2010
Le mercredi 10 novembre 2010 00:10:08, Paolo Corti a écrit :
> > No, there's no direct way of doing it with an API call. But as you can
> > only get a Band from a Dataset, you can easily do something like :
> > band = ds.GetRasterBand(xxx)
> > band.ds = ds
> Do we really need this? As far as I remember band must be in the same
> context of dataset (dataset can't go out of scope), so why would we
> need a reference to it?
You're 100% right. By the way, assigning the dataset as a member of the band
is an excellent means of making sure that we keep a reference to the dataset.
That's indeed the gist of the patch attached to ticket
> best regards
More information about the gdal-dev