-
Notifications
You must be signed in to change notification settings - Fork 908
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
DEP: GeoSeries.geom_almost_equals #2604
Conversation
hi @m-richards , could you please check on this. |
Hi @darshanip, this is unused code so is good to delete. With geom_almost_equals, we won't remove that yet, but should rather add a FutureWarning to indicate to users it will be removed in a future version. The warnings removed in #2267 are an example of the kind of message you should add here if you'd like some guidance. |
Due to linter error. geopandas/base.py:1100:89: E501 line too long (91 > 88 characters) geopandas/array.py:573:89: E501 line too long (91 > 88 characters)
@m-richards Could you please review the changes. |
@jorisvandenbossche @martinfleis, Could you please review changes. |
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.
Hi @darshanip, sorry for the delayed response.
This is looking good so far but there is a little bit more to do:
- We should update the tests using
geom_almost_equals
to usegeom_equals_exact
instead and the helper method intesting.py
- In
test_geoseries::test_geom_almost_equals
we should add a test to check the correct warning is emitted, and filter the warning from the other usages. - We should update the documentation in
data_structures.rst
to refer to geom_equals_exact instead.
- Updated shapely warning - Updated tests using geom_almost_equals to geom_equals_exact - Updated documentaion in data_structures.rst to refer geom_equals_exact instead. Pending - New test required for correct warning.
for 88 chars
@m-richards can you please review code. |
This reverts commit fd20790.
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.
Hi @darshanip, I've left a handful of further comments which should help with fixing some of the test errors.
geopandas/tests/test_dissolve.py
Outdated
@@ -61,7 +61,7 @@ def expected_mean(merged_shapes): | |||
def test_geom_dissolve(nybb_polydf, first): | |||
test = nybb_polydf.dissolve("manhattan_bronx") | |||
assert test.geometry.name == "myshapes" | |||
assert test.geom_almost_equals(first).all() | |||
assert test.geom_equals_exact(first).all() |
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 also needs to be updated to provide the second parameter for geom_equals_exact
Co-authored-by: Matt Richards <45483497+m-richards@users.noreply.github.com>
Co-authored-by: Matt Richards <45483497+m-richards@users.noreply.github.com>
Co-authored-by: Matt Richards <45483497+m-richards@users.noreply.github.com>
Co-authored-by: Matt Richards <45483497+m-richards@users.noreply.github.com>
Co-authored-by: Matt Richards <45483497+m-richards@users.noreply.github.com>
I've revived this, should be close to ready now. I'm not sure if we should also deprecate geopandas.testing.geom_almost_equals. I don't really see a huge issue with keeping it. If we were to deprecate, it would definitely be worth keeping a private internal helper for this. |
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!
I'm not sure if we should also deprecate geopandas.testing.geom_almost_equals.
Fine with keeping it as well.
Co-authored-by: Martin Fleischmann <martin@martinfleischmann.net>
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.
We cannot add a warning on both the array level and the base level as the warning is then emitted twice if the method is accessed from GeoSeries/DataFrame.
In [2]: from geodatasets import get_path
In [3]: df = geopandas.read_file(get_path('nybb'))
In [4]: df.geom_almost_equals(df)
<ipython-input-4-6eaa63e61711>:1: FutureWarning: The 'geom_almost_equals()' method is deprecated because the name isconfusing. The 'geom_equals_exact()' method should be used instead.
df.geom_almost_equals(df)
/Users/martin/Git/geopandas/geopandas/base.py:47: FutureWarning: The 'geom_almost_equals()' method is deprecated because the name isconfusing. The 'geom_equals_exact()' method should be used instead.
data = getattr(a_this, op)(other, *args, **kwargs)
We should have it one one level only, probably on array. We could also keep it on both level but use geom_equals_exact
array-level method in base-level geom_almost_equals
.
I've done the latter, it seems better to keep the warning in base.py so the stacklevel is correct for an end user. |
@martinfleis I've had to continue this at #3017 as I seem to no longer have push permissions on the fork. |
Superseded by #3017 |
Fixes #2538
Need confirmation, apart from the deletion I did do we need to remove 'geom_almost_equals' and its usages as well?
This is first code contribution in OS.