-
Notifications
You must be signed in to change notification settings - Fork 149
Create an empty centroids in Hazard.concat() with CRS from the first haz_list. #881
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
Conversation
|
Very well! Can you add tests and changelog? |
climada/hazard/base.py
Outdated
| haz_concat = haz_list[0].__class__() | ||
| haz_concat.haz_type = haz_list[0].haz_type | ||
| haz_concat.centroids = Centroids(lat=[], lon=[], crs=haz_list[0].centroids.crs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exactly! 😄
Alternatively one may inject the centroids as an argument of haz_list[0].__class__. (And possibly skip the haz_type assignment. I suspect that it is already assigned at that point through the constructor)
peanutfun
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@manniepmkam, as discussed in person, please
- fix the linter issue: Line too long
- add a unit test that covers the case reported in #879 (comment)
I have updated the line.
The unit test for hazard.base has been updated accordingly. Please review that. |
peanutfun
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, but you should check for the exact error message and not just any ValueError, see my comment.
|
@manniepmkam Thanks a lot for the bugfix! 🙌 |
…rd (CLIMADA-project#881) * add test for Hazard.concat for failing crs * Update error message for Centroids.append
Changes proposed in this PR:
This pull request is a fix for issue #879.
An empty centroids is created in the
Hazard.concat()function with the crs from the haz object from the haz_list.This PR fixes #
PR Author Checklist
develop)PR Reviewer Checklist