-
Notifications
You must be signed in to change notification settings - Fork 124
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
added get_bounds functions for EPSG 4326 #980
base: develop
Are you sure you want to change the base?
Conversation
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.
This looks good overall,
I made some minor suggestions, you may choose to ignore (except maybe the additional tests).
), | ||
(175, -20, 530, 90), | ||
) | ||
|
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.
You should add tests for invalid bounding box.
Co-authored-by: Samuel Juhel <10011382+spjuhel@users.noreply.github.com>
climada/util/coordinates.py
Outdated
# print warning if ISO code not recognized | ||
for country_name in country_names: | ||
if not country_name in nat_earth[["ISO_A3", "WB_A3", "ADM0_A3"]].values: | ||
LOGGER.warning(f"ISO code {country_name} not recognized.") |
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.
wouldn't it be better to simply throw an exception in case the country is not recognized?
I can't see the point of filtering out the unrecognizable countries in here. If a user runs this with a typo in one of the country names would they be upset if it fails?
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.
Yes I agree, this would be better. I changed it to raise a ValueError now.
My only doubt is that the function util.coordinates.get_country_geometries() existed before and if you input a list of ISO codes with one invalid code, it did NOT raise an error before (this is why I "only" added a warning). Wouldn't this be a potential problem for existing code to break down due to the error, or is it better to make aware that the input was not correct?
Changes proposed in this PR:
global_bounding_box
,get_country_bounding_box
andbounds_from_cardinal_bounds
in the climada.util.coordinates module.Notes
PR Author Checklist
develop
)PR Reviewer Checklist