[Gdal-dev] GDAL 1.3.0 Beta1 Released
Frank Warmerdam
fwarmerdam at gmail.com
Mon Aug 8 09:39:48 EDT 2005
On 8/8/05, Alessandro Amici <lists at b-open-solutions.it> wrote:
>
> Frank,
>
> to correct my initial posting i actually take a reference to a band with
> GetBand(1) and not to the dataset it is attached to.
>
> On Sunday 07 August 2005 23:56, Frank Warmerdam wrote:
> > This does sound like something is corrupt in the GDALRasterBand
> > (or GDALDataset).
>
> any chance that the dataset reference count goes to zero if i only bring along
> the band object...
>
> [trying...]
>
> BINGO!
>
> if i carry along a reference to the original dataset together the reference to
> that raster band everything works ;)
>
> so, from the look of it the ReadAsArray method uses something from the dataset
> c++ object, but the 'pythonic' band object doesn't take a 'pythonic'
> reference to its parent dataset that gets garbage collected. is it right?
Alessandro,
Ah, I have run into this in python scripts. It is important to keep around
a gdal.Dataset() reference till you are all done with the dataset or it
gets closed. You are right that any gdal.Band objects ought to also
acquire a reference to the dataset, though I think that is a bit hard
for various reasons. Mainly because bands can exist without an
explicit relationship to a dataset in some odd situations.
If you wish, you can open a bug report in bugzilla on this issue,
and we can try to correct it in the NG bindings.
Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush | Geospatial Programmer for Rent
More information about the Gdal-dev
mailing list