Skip to content

fix(map2loop): InterpolatedStructure contact/dip selection and StructuralPoint strike wraparound - #327

Open
lachlangrose wants to merge 1 commit into
masterfrom
fix/interpolated-structure-and-strike-wraparound
Open

lachlangrose wants to merge 1 commit into
masterfrom
fix/interpolated-structure-and-strike-wraparound

Conversation

@lachlangrose

Copy link
Copy Markdown
Member

Summary

Ported from Loop3D/map2loop#248 (closing that PR / archiving the standalone repo now that map2loop lives at packages/map2loop).

Three correctness bugs in the two most-used thickness calculators (InterpolatedStructure is the project default; StructuralPoint is the other user-facing option) in packages/map2loop:

  • InterpolatedStructure picked the wrong basal contact segment. shapely.shortest_line(point, top_contact_geometry) broadcasts across the list of top-contact geometries and returns one candidate line per list entry; the code always took short_line[0]. Whenever a basal contact is split into more than one feature (common across faults or map-sheet edges), the thickness estimate silently used an arbitrary segment instead of the nearest one. Now the candidate with the minimum length is selected.
  • InterpolatedStructure sampled dip from the wrong unit. The measured line spans stratigraphic_order[i + 1] (the unit whose thickness is being computed), but dip was pulled from interpolated points in stratigraphic_order[i] (the overlying unit). Dip is now sampled from the unit actually being measured.
  • StructuralPoint rejected valid strike matches near due north. The strike-allowance check compared strike1/strike2 against a plain numeric range (strike - allowance, strike + allowance). Strike is a compass bearing that wraps at 360°, so e.g. a measured strike of 5° and a contact strike of 350° (15° apart) failed the check even though they're well within the 30° default tolerance. Replaced with an angular-difference comparison that handles wraparound.

Test plan

  • pytest packages/map2loop/tests/thickness — all 3 existing suites (InterpolatedStructure, StructuralPoint, ThicknessCalculatorAlpha) pass unchanged
  • pytest packages/map2loop/tests/project/test_thickness_calculations.py passes unchanged

…alPoint strike wraparound

InterpolatedStructure:
- shapely.shortest_line(point, top_contact_geometry) broadcasts over the
  list of top-contact geometries and returns one line per entry. The code
  took short_line[0] unconditionally, so whenever a basal contact was split
  into more than one feature (common across faults or map-sheet edges) the
  thickness estimate used an arbitrary segment instead of the nearest one.
  Now the candidate with the smallest length is selected explicitly.
- Dip was sampled from stratigraphic_order[i] (the overlying unit) while the
  measured line spans stratigraphic_order[i + 1] (the unit whose thickness
  is being computed). Dip is now sampled from the same unit being measured.

StructuralPoint:
- The strike-allowance check compared strike1/strike2 against a plain
  numeric range (strike - allowance, strike + allowance). Strike is a
  compass bearing that wraps at 360 degrees, so measurements near due
  north (e.g. strike=5, contact strike=350) were incorrectly rejected even
  though they are well within tolerance. Replaced with an angular
  difference check that handles the wraparound correctly.

Ported from Loop3D/map2loop#248 (that repository is being archived now
that map2loop lives in packages/map2loop of this monorepo).

This branch has not been deployed

No deployments
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.

1 participant