Closed jessjaco closed 11 months ago
Hm, I think that code should just catch a more generic rasterio.errors.RasterioError
, or even Exception
.
I'm not sure about the value of capturing user configured exception types, this might be reasonable if we had support for multiple IO backends, but we only have rasterio
backend right-now.
Ok, makes sense I'm testing it out,
thanks @jessjaco, happy to accept a PR if that works for you.
And for a more generic handling of errors I'd rather go with a user supplied callback, although Dask adds some constraints on that approach.
I'm getting an error while reading a tiff that starts with
rasterio._err.CPLE_AppDefinedError: IReadBlock failed at X offset 9, Y offset 3: TIFFReadEncodedTile() failed
etc. and ends withrasterio.errors.WarpOperationError: Chunk and warp failed
. I can send a more detailed example but ultimately this is a bad data file, and I just want to ignore the error and go on to the next file.I see here https://github.com/opendatacube/odc-stac/blob/52a016be2115f180e7059f67bcc6106fbeba7e8d/odc/stac/_reader.py#L187 that this specific error is not ignored. Would it be possible to set the specific errors that could be ignored, or something similar? As an example,
stackstac.stack
has an errors_as_nodata option, which allows specific errors to be defined.