Skip to content
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

[MAINT] Update deprecated shapely.ops.cascaded_union to shapely.ops.unary_union #471

Open
imharrisonking opened this issue Nov 19, 2023 · 0 comments

Comments

@imharrisonking
Copy link

Maintenance request summary

Calling the solaris.vector.mask.df_to_px_mask function is throwing the below depreciation warning related to shapely.ops.cascaded_union which has been superseded by the more performant shapely.ops.unary_union and deprecated in Shapely 1.8. Proposing that this is updated.

ShapelyDeprecationWarning: The 'cascaded_union()' function is deprecated. Use 'unary_union()' instead.
gs[x['gs_idx']].intersection(cascaded_union(gs[x['intersectors']]))

This is called from solaris/utils/geo.py on line 474:

 output_polys = []
  _ = intersect_lists.apply(lambda x: output_polys.append(
      gs[x['gs_idx']].intersection(cascaded_union(gs[x['intersectors']]))
  ), axis=1)
  # we then generate the union of all of these intersections and return it.
  return cascaded_union(output_polys)

Task detail and notes

Straight swap of cascaded_union for unary_union in geo.py and updating of tutorials and tests that use cascaded_union (see below).

Any additional information:
Not sure what the plans are in terms of moving to a newer version of Shapely in future releases of solaris, or how actively maintained this project is, but I'm loving the solaris.vector.mask.df_to_px_mask function and I'm happy to fork a branch and make the below proposed changes.

  • What other code will this impact?
    Tests:
  • tests/test_tile.py
  • test_geo.py

Tutorials in docs:

  • api_mask_to_vector.ipynb

  • api_masks_tutorial.ipynb

  • Do new tests need to be written or do existing tests need to be updated?

  • Yes, see above

  • Will this impact documentation?

  • Yes, for tutorials, see above

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant