Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow errors besides RasterioIOError in odc.stac.load with fail_on_error=False #122

Closed
jessjaco opened this issue Aug 4, 2023 · 3 comments · Fixed by #137
Closed

Allow errors besides RasterioIOError in odc.stac.load with fail_on_error=False #122

jessjaco opened this issue Aug 4, 2023 · 3 comments · Fixed by #137

Comments

@jessjaco
Copy link

jessjaco commented Aug 4, 2023

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 with rasterio.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

except rasterio.errors.RasterioIOError as e:

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.

@Kirill888
Copy link
Member

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.

@jessjaco
Copy link
Author

jessjaco commented Aug 5, 2023

Ok, makes sense I'm testing it out,

@Kirill888
Copy link
Member

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.

Kirill888 added a commit that referenced this issue Nov 30, 2023
Kirill888 added a commit that referenced this issue Dec 18, 2023
Kirill888 added a commit that referenced this issue Dec 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants