-
Notifications
You must be signed in to change notification settings - Fork 901
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
API: Raise warning when overriding a CRS via crs property setter #3088
Conversation
As noted in #3085, we'll need to cover both GeoSeries and GeoDataFrame here. |
There seems to be an issue with |
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've fixed the usage of GeoSeries.crs setter in GeoSeries.set_geometry and pushed one minor commit to ensure_geometry along the same lines.
A consequence of this warning is that due to usage of setter in some places and especially in tests, we have a ton of there warnings in our CI which we should ideally clear, especially if this will raise eventually.
@JohnMoutafis would you have time to update for the comments of @martinfleis ? |
@jorisvandenbossche I will try to find some (hopefully soon) |
@JohnMoutafis given we'd like to have this included in 1.0 which shall be released hopefully soon, I have pushed some commits myself, mostly resolving my own comments. |
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.
Thanks for getting this going @JohnMoutafis!
@martinfleis sorry for not finding the time to handle the requested changes. |
I think it is ready to be merged, just want to wait for another review. The coverage can be ignored I suppose, given the patch has 100%. It tends to be flaky from time to time. |
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, thanks!
"Overriding the CRS of a GeoSeries that already has CRS." | ||
"This unsafe behavior will be deprecated in future versions." |
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.
Sorry a bit late now, but these lines are missing spaces after the full stops inside the quotes (this also happens once above in the geodataframe warning).
I also see in the dev env that the warnings are getting triggered by pandas code in certain tests, which we may want to look into, but I suppose there's still quite a bit of time before the deprecation is enforced.
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.
Sorry, missed that in re-reviewing, good catch! Will do a quick follow-up to fix
I think they are being triggered in general in our tests. Looking at the ones in test_geodataframe.py, it seems this comes from doing Do we want to accept |
Yeah, I noted that in #3088 (review) and then forgot about it.
I think that we should have a canonical way of removing crs and In the tests, we can potentially replace that by assigning to the |
Refs: #3085
For the current version: Warn the user that tries to manually change a GeoSeries' existing CRS by the property setter (ex.
gs.crs = "new crs"
), that the setter will be deprecated in future versions and that theset_crs
method should be used instead.