add try except for lazy loading zarr. raise informative error messsage#129
Open
mdeshotel wants to merge 1 commit intodevelopmentfrom
Open
add try except for lazy loading zarr. raise informative error messsage#129mdeshotel wants to merge 1 commit intodevelopmentfrom
mdeshotel wants to merge 1 commit intodevelopmentfrom
Conversation
mxkpp
requested changes
Apr 2, 2026
| return CRS(xr.open_zarr(ObjectStore(object_store)).rio.crs) | ||
| except Exception as e: | ||
| raise ValueError( | ||
| f"Unable to open zarr: {self.url}. Check that the zarr data on s3 is valid. Error: {e}" |
There was a problem hiding this comment.
Error message needs to be improved. self.url is a method not a string. Also in this case, the error could be related to the CRS() call. Please revisit each of them.
Exception handling should be improved too. ValueError is not right, and should preserve the original traceback. Something like this.
except Exception as e:
raise RuntimeError(f"foobar. Error {e}") from e
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds try and except statements around s3 zarr reads and provides a more descriptive error message letting the user know that there is an issue reading the s3 zarr and that there may be an issue with the s3 data.
Additions
-Try and except statements around s3 zarr reads.
Removals
Changes
Testing
Screenshots
Notes
Todos
Checklist
Testing checklist
Target Environment support