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

raise error when xarray dataset have wrong geo information #726

Merged
merged 6 commits into from
Sep 4, 2024

Conversation

vincentsarago
Copy link
Member

another solution for #718 and #717

This is a bit more classic in a way that this PR adds checks for missing CRS or invalid Geographic bounds and then will raise an error directly when opening the dataset.

ref #725 (comment)

Copy link
Contributor

@j08lue j08lue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO, the early failure here is nicer than the the configurable fallback CRS + potential head scratching of #725. 👌

tests/test_io_xarray.py Outdated Show resolved Hide resolved
rio_tiler/io/xarray.py Show resolved Hide resolved
Copy link
Contributor

@j08lue j08lue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This gives users more helpful error messages when CRS is missing or their bounds are outside the expected range, closing

I think this is preferable to the more auto-magic solution proposed in #725.

NB: I added a comment below to let the users know which range is expected, since this is a GDAL peculiarity - longitude values outside that range are perfectly fine elsewhere. Up to you whether you want to accept my suggestion.

rio_tiler/io/xarray.py Show resolved Hide resolved
rio_tiler/io/xarray.py Outdated Show resolved Hide resolved
@vincentsarago vincentsarago merged commit 7b4816c into main Sep 4, 2024
8 checks passed
@vincentsarago vincentsarago deleted the feature/raise-error-for-invalid-geo branch September 4, 2024 22:44
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 this pull request may close these issues.

2 participants