Open MattArran opened 7 months ago
I suspect the cleanest approach is to make GeoTiff
a derived class of TiffFile
, inheriting .close()
and the with
context managers. But I imagine there's a reason you've not followed that route, so will work on a quick fix with connections closed separately.
Hi!
Thanks for the package- it's good to have a GeoTIFF reader that doesn't require struggling with GDAL. Unfortunately, I've been running into a bug in applying geotiff to my use case, in which I need to extract, process, and then remove GeoTIFFs, in Windows. Specifically,
GeoTiff.read_box
successfully reads data from a GeoTIF file but doesn't close the file connection, so that subsequent attempts to remove the file fail.Example, using the downloaded GeoTiff https://download.osgeo.org/geotiff/samples/usgs/o41078a7.tif:
Examining the code, I've identified the problem as the processing of the ZarrTiffStore produced by
tif.aszarr
in__init__
: whilestore.close()
closes the connection, it's reopened by slicing of the Zarr arrayself._z
and, while the Zarr array itself doesn't need closing, the store connection does:Environment:
Windows 11 Enterprise requirements.txt