Separate Hazard xarray reader into its own module#1063
Merged
Conversation
* Make `Hazard.from_raster_xarray` handle files. * Update tests * Fix linter issues
Member
Author
|
Tests fail only in Petals, but unrelated to this PR, see CLIMADA-project/climada_petals#177 |
emanuel-schmid
approved these changes
Aug 25, 2025
Collaborator
emanuel-schmid
left a comment
There was a problem hiding this comment.
Great work! Much cleaner now. Many thanks.
I've pushed minor cosmetic changes to io.py and marked xarray functions that could also be private. I'm not sure whether they have a use outside of that module. But it doesn't matter much.
Member
Author
|
@emanuel-schmid I marked all free functions of the module as private. Thanks for the review and cosmetic updates! Merging now... |
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.
Changes proposed in this PR:
Hazard.from_raster_xarrayinto a separate module. This avoids an excessively long and complicated single function.Hazard.from_raster_xarray_file. The module separation lets us handle files and datasets elegantly without a separate method.PR Author Checklist
develop)PR Reviewer Checklist