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

perf(Gridintersect): optimize intersection methods for shapely 2.0 #1666

Merged
merged 29 commits into from
Dec 23, 2022

Conversation

dbrakenhoff
Copy link
Contributor

Making use of shapely's new array-based functions, maintaining backwards compatibility with shapely<2.0.

  • increases performance by at least 2-10x
  • add methods optimized for shapely 2.0 (_intersect_*_shapely2)
  • add temporary shapely2 flag to intersect() for comparing with old implementation.
  • add shapely 2.0 logic to intersects()
  • deprecate keepzerolengths for shapely intersection methods (was not used).
  • fix bug when using facecolor in plot_polygon()
  • add tests for multilinestrings along cell boundaries
  • clean up tests a bit
  • improve/update grid intersection notebook

jdhughes-usgs and others added 22 commits June 11, 2020 11:26
ensure one entry per grid cell in polygon intersection result
add test for this case
bug in structured mode where linestrings were not handled
correctly if they pass in and out of grid cell
- fix vertices when intersecting linestring with offset grids
- increases performance by at least 2-10x
- add methods optimized for shapely 2.0 (`_intersect_*_shapely2`)
- add temporary shapely2 flag to `intersect()`
- add shapely 2.0 logic to intersects()
- deprecate keepzerolengths for shapely intersection methods (was not used).
- fix bug when using facecolor in plot_polygon()
- add tests for multilinestrings along cell boundaries
- clean up tests a bit
- improve/update grid intersection notebook
@codecov
Copy link

codecov bot commented Dec 20, 2022

Codecov Report

Merging #1666 (e1b7fa9) into develop (1e6991d) will decrease coverage by 0.1%.
The diff coverage is 76.8%.

@@            Coverage Diff            @@
##           develop   #1666     +/-   ##
=========================================
- Coverage     71.6%   71.4%   -0.2%     
=========================================
  Files          253     253             
  Lines        55724   55873    +149     
=========================================
+ Hits         39921   39926      +5     
- Misses       15803   15947    +144     
Impacted Files Coverage Δ
flopy/utils/gridintersect.py 65.6% <76.8%> (-10.6%) ⬇️

"fix" test for rotated structured grid
fix getting lay, row, col for structured grids in intersects()
fix failing tests
Copy link
Contributor

@mwtoews mwtoews left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great and tests nicely with old and new shapely versions, thanks!

@mwtoews mwtoews merged commit 1114c93 into modflowpy:develop Dec 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants