Skip to content

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

Description

@lispandfound

Location: source_modelling/fsp.py:120

What happens: FspSegment.to_plane converts the great-circle strike to an NZTM bearing, but passes the segment's width as the shift distance:

120: strike_nztm = coordinates.great_circle_bearing_to_nztm_bearing(
121:     self.top_centre, self.width, self.strike
122: )

The distance parameter of great_circle_bearing_to_nztm_bearing is the distance shifted along the bearing being converted (qcore/coordinates.py:193-194, "The distance to shift"; 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 (self.length), not the down-dip width.

Why that's wrong: 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 (used at :127 for projected_width_m), so the strike call is reusing the wrong extent.

How to reproduce: For any FSP segment with length != width, strike_nztm is computed from a shift of width km rather than length km along the strike bearing.

Scale, measured at origin (-43.5, 172.6) with a great-circle bearing of 45 deg:

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

In practice the numerical impact is tiny — about 0.001 deg across a 5-60 km range, since the NZTM convergence correction is dominated by the origin latitude rather than the distance. So this is a correctness/clarity fix rather than a bug with visible consequences, and it is not urgent. Filing it because the argument is plainly the wrong quantity and will mislead the next reader.

Suggested direction: Pass self.length at :121. Naming the parameter at the call site (distance=self.length) would make the pairing with self.strike obvious.

Confidence: high (that the argument is wrong); low (that it changes any result materially)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ai-sweepFiled by an automated /bug-sweep runbugSomething isn't workingimpact:lowscope:source_modellingSweep scope: source_modelling package

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions