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

Feat(plot_centers): add plot_centers support to PlotMapView and PlotCrossSection #2318

Merged
merged 5 commits into from
Oct 7, 2024
Merged

Conversation

jlarsen-usgs
Copy link
Contributor

@jlarsen-usgs jlarsen-usgs commented Sep 26, 2024

fixes and updates included with feature:

  • filter very short/small intersection segments from cross-sectional plotting routine
  • sort and assure vertex order is correct for intersected cross-sectional segments
  • improve geometry.project_point_onto_xc_line() calculation routine.
  • update reproject_modpath_to_crosssection()

closes #2299

…rossSection

fixes and updates included with feature:

* filter very short/small intersection segments from cross-sectional plotting routine
* sort and assure vertex order is correct for intersected cross-sectional segments
* improve geometry.project_point_onto_xc_line() calculation routine.
* update reproject_modpath_to_crosssection()
@jlarsen-usgs
Copy link
Contributor Author

@wpbonelli, do you have any insight into the windows failures/have you seen this before? CI is failing on the Install modflow executables step with an error that states "python3 is not recognized ..."

* add projctr attribute to PlotCrossSection for testing purposes
@jlarsen-usgs jlarsen-usgs marked this pull request as ready for review September 27, 2024 17:54
@wpbonelli
Copy link
Member

I think there may be a couple things going on... one being, GH evidently dropped some items from their API responses https://github.com/orgs/community/discussions/140079 when a token is present on the request. Easy enough to work around. Idk about the python not found issue. I will take a closer look later today

Copy link

codecov bot commented Oct 5, 2024

Codecov Report

Attention: Patch coverage is 76.64234% with 32 lines in your changes missing coverage. Please review.

Project coverage is 74.3%. Comparing base (181e101) to head (75816fe).
Report is 8 commits behind head on develop.

Files with missing lines Patch % Lines
flopy/plot/crosssection.py 68.8% 19 Missing ⚠️
flopy/plot/map.py 60.8% 9 Missing ⚠️
flopy/utils/geometry.py 87.0% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##           develop   #2318     +/-   ##
=========================================
- Coverage     75.6%   74.3%   -1.3%     
=========================================
  Files          294     294             
  Lines        59560   59677    +117     
=========================================
- Hits         45073   44395    -678     
- Misses       14487   15282    +795     
Files with missing lines Coverage Δ
flopy/plot/plotutil.py 56.8% <100.0%> (+0.7%) ⬆️
flopy/utils/geometry.py 75.6% <87.0%> (+1.5%) ⬆️
flopy/plot/map.py 82.2% <60.8%> (-1.3%) ⬇️
flopy/plot/crosssection.py 67.1% <68.8%> (+0.2%) ⬆️

... and 89 files with indirect coverage changes

Copy link
Member

@wpbonelli wpbonelli left a comment

Choose a reason for hiding this comment

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

looks good to me, made a couple comments.

dy = np.abs(y0 - y1)
dx = x1 - x0
dy = y1 - y0
if dx == 0:
Copy link
Member

Choose a reason for hiding this comment

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

is the exact zero check sufficient or would approximate equality be safer? to avoid not only inf but unrepresentably large slope (greater than sys.float_info.max)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The exact zero check is only to avoid an "inf" condition in the case of a vertical line, which is a common occurance (e.g., line={"column": 1}). In this case we want to replace dx=0 with dx=very small number to be able to approximate the calculation.

return bx, by


def distance(x0, y0, x1, y1):
Copy link
Member

Choose a reason for hiding this comment

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

could use math.dist or np.linalg.norm instead? idk how the performance compares.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

math.dist only operates over individual point instances, so would require an additional loop. np.sqrt(...) and np.linalg.norm are reported to have similar performance. Opted for adding a distance method to be more explicit, and because distance is calculated in multiple methods within PlotCrossSection.

@jlarsen-usgs jlarsen-usgs merged commit c6a41ab into modflowpy:develop Oct 7, 2024
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feature: flopy.plot.crosssection plot cell centres (DISU)
2 participants