Skip to content

Use along-strike length when converting the FSP strike bearing - #106

Merged
lispandfound merged 1 commit into
mainfrom
fix/91-fsp-strike-uses-length
Sep 9, 2026
Merged

Use along-strike length when converting the FSP strike bearing#106
lispandfound merged 1 commit into
mainfrom
fix/91-fsp-strike-uses-length

Conversation

@lispandfound

Copy link
Copy Markdown
Contributor

Fixes #91

Problem

FspSegment.to_plane converted the great-circle strike to an NZTM bearing but passed the segment's width as the shift distance:

# before
strike_nztm = coordinates.great_circle_bearing_to_nztm_bearing(
    self.top_centre, self.width, self.strike
)

The distance parameter is the distance shifted along the bearing being converted (qcore/coordinates.py:193-194; the implementation calls geo.ll_shift(x, y, distance, great_circle_bearing)). Since the bearing here is the strike, the distance should be the along-strike extent.

srf.py:608-612 performs the same conversion for a strike and correctly passes the along-strike segment_header["len"]. Within to_plane itself, self.width is legitimately the distance for the dip direction a few lines below, which is where the confusion came from.

Scale of the effect — small

Measured at origin (-43.5, 172.6) for a great-circle bearing of 45 degrees:

distance =  5.0 km -> 44.826196
distance = 20.0 km -> 44.826554
distance = 60.0 km -> 44.827250

About 0.001 degrees across a 5-60 km range: the NZTM convergence correction is dominated by origin latitude, not by distance. So this is a correctness and clarity fix, not one with visible consequences — flagged because the argument is plainly the wrong quantity and will mislead the next reader. I would not prioritise merging it.

Changes

  • source_modelling/fsp.py — pass self.length.

No test added: the difference is far below any tolerance a meaningful assertion could use, so a test would either be vacuous or pin down floating-point noise. The srf.py precedent is the real evidence.

Verification

  • pytest tests/test_fsp.py — 158 passed.
  • ruff check, ruff format clean.

🤖 Generated with Claude Code

great_circle_bearing_to_nztm_bearing takes the distance shifted along the
bearing being converted, but FspSegment.to_plane passed the segment's
down-dip width while converting its strike. srf.py does the same
conversion for a strike and correctly passes the along-strike len.

The numerical effect is small -- the NZTM convergence correction varies
by roughly 0.001 degrees between 5 and 60 km, being dominated by origin
latitude rather than distance -- so this is a correctness and clarity fix
rather than one with visible consequences. self.width remains the right
distance for the dip direction a few lines below.

Fixes #91

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@lispandfound
lispandfound merged commit dc6073c into main Sep 9, 2026
7 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.

fsp.py: strike bearing conversion passes width where along-strike length belongs

1 participant