Add more intuitive unit specification when creating Hazard object via attrs keyword#1287
Open
ChrisFairless wants to merge 8 commits intodevelopfrom
Open
Add more intuitive unit specification when creating Hazard object via attrs keyword#1287ChrisFairless wants to merge 8 commits intodevelopfrom
ChrisFairless wants to merge 8 commits intodevelopfrom
Conversation
* ci: Add job for Mamba installation * ci: Import CLIMADA in bash and powershell * ci: Run impact test when testing the installation
… attrs keyword The Hazard.from_raster method allows you to specify an `attrs` dictionary to set additional parameters in the created Hazard's `__init__` method. This commit - allows you to set both 'unit' and 'units' which will be used as the 'units' parameter when the Hazard object is created, with 'units' taking priority. Currently only 'unit' is accepted which is very counterintuitive, since all other attributes are exactly as specified in the `__init__` - adds an ATTRS_TO_CHECK constant to the hazard module's io.py so that the user can see what is supported in the source code (and removes a comment that suggests doing this). - updates the documentation
- Allow event names that are integers (some test files have integer names) - even though this is NOT ALLOWED - Allow core or numpy integers/booleans/strings
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.
The
Hazard.from_rastermethod allows you to specify anattrsdictionary that are passed to the created Hazard's__init__method. It behaves differently from a normalkwargsargument in that the attributes are processed and "sensible defaults" are provided when they are missing.The issues
__init__method has to be specified through "unit", and this isn't explained anywhereThis commit
ATTRS_TO_CHECKconstant to the hazard module's io.py so that the user can see what is supported in the source code (and removes a comment that suggests doing this)PR Author Checklist
develop)PR Reviewer Checklist