-
Notifications
You must be signed in to change notification settings - Fork 149
Tag-Refactoring #736
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
Tag-Refactoring #736
Conversation
…climada_python into feature/tag_refactoring
…tag_refactoring # Conflicts: # climada/hazard/test/test_base.py # climada/hazard/test/test_storm_europe.py
# Conflicts: # climada/entity/exposures/base.py # climada/entity/exposures/litpop/litpop.py
chahank
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.
Great improvement toward the consolidation of the tag classes. Thanks!
climada/engine/impact.py
Outdated
| from pyproj import CRS as pyprojCRS | ||
| from rasterio.crs import CRS as rasterioCRS # pylint: disable=no-name-in-module | ||
|
|
||
| from climada.entity import Exposures, Tag |
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.
| from climada.entity import Exposures, Tag | |
| from climada.entity import Exposures | |
| from climada.util.tag import Tag |
Should it not be like this?
climada/hazard/trop_cyclone.py
Outdated
| haz.frequency_from_tracks(tracks.data) | ||
| haz.tag.description = description | ||
| haz.tag.append(Tag(description=description)) | ||
| print('tag tag tag ', haz.tag) |
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.
| print('tag tag tag ', haz.tag) |
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.
oops! 😊
| return list_of_str | ||
|
|
||
|
|
||
| class Tag(): |
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.
In another file, there is an equality comparison for tags. Should then the __eq__ not be defined?
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.
Good point! And actually yes, Tag is just the kind of object/class where implementing __eq__ would make a lot of sense, imho.
However - since Tag is to be removed altogether, I guess the effort is not justified.
(The effort of implementing __eq__ may be small enough but finding the places where it can or should be used seems to be serious work.)
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.
I fully agree. I would just remove the equality comparison.
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.
😲 Er - which equality comparison?
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.
I thought I had seen a tag equality comparison in one file last time I did the review. Unfortunately, I did not write down where, so maybe I was mistaken.
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.
I superficially looked for one but couldn't find it. Shall we remove it when we stumble across?
Changes proposed in this PR:
haz_typeout ofTagand move it toHazardentity.Tagandhazard.Tagtoutil.TagThis PR paves the ground for the eventual removal of the
tagattributes from all climada classes.PR Author Checklist
develop)PR Reviewer Checklist