Skip to content

GEOPY-3046: Implement borehole EM inversion - #220

Open
domfournier wants to merge 10 commits into
developfrom
GEOPY-3046
Open

GEOPY-3046: Implement borehole EM inversion#220
domfournier wants to merge 10 commits into
developfrom
GEOPY-3046

Conversation

@domfournier

@domfournier domfournier commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

GEOPY-3046 - Implement borehole EM inversion

@github-actions github-actions Bot changed the title GEOPY-3046 GEOPY-3046: Implement borehole EM inversion Aug 31, 2026
@domfournier
domfournier marked this pull request as ready for review August 31, 2026 18:53
Copilot AI lite review requested due to automatic review settings August 31, 2026 18:53
@codecov

codecov Bot commented Aug 31, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.09%. Comparing base (14c4c81) to head (9fc7b58).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #220      +/-   ##
===========================================
+ Coverage    85.78%   86.09%   +0.30%     
===========================================
  Files           18       18              
  Lines          950      971      +21     
  Branches       126      128       +2     
===========================================
+ Hits           815      836      +21     
  Misses          99       99              
  Partials        36       36              
Files with missing lines Coverage Δ
geoapps_utils/utils/locations.py 89.53% <100.00%> (+2.39%) ⬆️
geoapps_utils/utils/numerical.py 100.00% <100.00%> (ø)
geoapps_utils/utils/transformations.py 96.61% <100.00%> (+0.14%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR adds utilities and tests for working with borehole/curve orientation (azimuth/dip) derived from Cartesian vectors/segments, and updates a KD-tree query to use multi-threading.

Changes:

  • Added cartesian_to_azimuth_dip transformation and corresponding unit tests.
  • Added azimuth_dip_from_segments for Curve objects with tests validating angle ranges and reverse-direction behavior.
  • Updated weighted_average to query cKDTree with workers=-1.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/transformations_test.py Adds parametrized test coverage for the new Cartesian→(azimuth,dip) conversion.
tests/locations_test.py Adds integration-style test for segment-based azimuth/dip on Curve vertices (including reverse flag).
geoapps_utils/utils/transformations.py Introduces cartesian_to_azimuth_dip built on existing spherical conversion and azimuth convention helpers.
geoapps_utils/utils/numerical.py Enables parallel KD-tree queries via workers=-1 in weighted_average.
geoapps_utils/utils/locations.py Adds azimuth_dip_from_segments for deriving vertex orientations from curve segment deltas.
Suppressed comments (1)

geoapps_utils/utils/locations.py:258

  • The azimuth “wrap-around” handling uses a modulo’d positive difference, which can pick the long way around the circle (e.g., averaging 10° and 350° yields ~180°). This will produce incorrect vertex directions when segment azimuths straddle 0/2π in the opposite ordering.
    # Deal with (-pi, pi) or (0, 2pi) transition
    d_azm = np.diff(azimuth, axis=1) % (2 * np.pi)
    direction = azimuth[:, 0] + d_azm.flatten() / 2.0
    end_lines = np.where(np.isnan(azimuth).sum(axis=1))
    direction[end_lines] = np.nansum(azimuth, axis=1)[end_lines]

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread geoapps_utils/utils/transformations.py Outdated
Comment thread geoapps_utils/utils/locations.py Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.

Suppressed comments (2)

Previously missed (2) — in code that hasn't changed since the last review.

geoapps_utils/utils/locations.py:254

  • The modulo always selects the positive arc between the two segment azimuths, not the shortest arc. For example, azimuth columns of 10° and 350° produce 180° here rather than the correct circular midpoint of 0°, so curves turning through north in that ordering get a reversed local direction. Normalize the delta to [-pi, pi) and normalize the resulting direction; the test should also cover this wrap ordering.
    tests/locations_test.py:225
  • Use “except” here: the assertion intentionally excludes the first and last points.

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.

2 participants