Location: source_modelling/community_fault_model.py:547
What happens: feature_trace decides whether to reverse a fault trace by comparing the strike against a compass bearing with >:
545: compass_direction = CompassDirection[feature.properties["Dip_dir"]]
546: if strike > compass_direction.value:
547: points = points[::-1]
CompassDirection values are fixed bearings — NE = 45, SE = 135, SW = 225, NW = 315 (:58-76). A scalar > against one of those is not a test of which side of the trace the fault dips towards; it partitions the strike circle at an arbitrary point and breaks across 0/360.
Why that's wrong: The intent is the right-hand-rule convention: order the trace so the fault dips to the right of the along-strike direction, i.e. so that dip_dir ~= strike + 90 (mod 360). The correct test is whether the actual dip direction is within 90 deg of strike + 90, which requires modular arithmetic. As written:
Dip_dir = NW (315) with strike = 20: 20 > 315 is false, so the trace is left as-is. The implied dip direction is 20 + 90 = 110 (ESE) — the opposite side from NW — so this trace should have been reversed.
Dip_dir = NE (45) with strike = 350: 350 > 45 is true, so the trace is reversed. But 350 + 90 = 80 (ENE) is already within 90 deg of NE, so reversing it makes the convention wrong.
Any downstream consumer relying on trace order — and nodal_plane_from_neighbours does, via line_segment_strike at :494 — inherits the error.
How to reproduce: Any CFM feature whose Dip_dir and trace strike straddle the comparison boundary, e.g. Dip_dir = "NW" with a trace striking 020 deg, or Dip_dir = "NE" with a trace striking 350 deg. Both are ordered contrary to the convention the code is trying to enforce.
Suggested direction: Needs a convention decision from someone who knows the CFM data, so no PR is attached. The standard form is to reverse when the signed angular difference between compass_direction.value and strike + 90 exceeds 90 deg, computed modulo 360 — e.g. if ((compass_direction.value - (strike + 90) + 180) % 360) - 180 > 90. Worth confirming against the CFM shapefile whether Dip_dir is authoritative or advisory, and whether the four diagonal values are the only ones that occur. Related: the strike comparisons at :476 (companion issue).
Confidence: high
Location:
source_modelling/community_fault_model.py:547What happens:
feature_tracedecides whether to reverse a fault trace by comparing the strike against a compass bearing with>:CompassDirectionvalues are fixed bearings —NE = 45,SE = 135,SW = 225,NW = 315(:58-76). A scalar>against one of those is not a test of which side of the trace the fault dips towards; it partitions the strike circle at an arbitrary point and breaks across 0/360.Why that's wrong: The intent is the right-hand-rule convention: order the trace so the fault dips to the right of the along-strike direction, i.e. so that
dip_dir ~= strike + 90 (mod 360). The correct test is whether the actual dip direction is within 90 deg ofstrike + 90, which requires modular arithmetic. As written:Dip_dir = NW(315) withstrike = 20:20 > 315is false, so the trace is left as-is. The implied dip direction is20 + 90 = 110(ESE) — the opposite side from NW — so this trace should have been reversed.Dip_dir = NE(45) withstrike = 350:350 > 45is true, so the trace is reversed. But350 + 90 = 80(ENE) is already within 90 deg of NE, so reversing it makes the convention wrong.Any downstream consumer relying on trace order — and
nodal_plane_from_neighboursdoes, vialine_segment_strikeat:494— inherits the error.How to reproduce: Any CFM feature whose
Dip_dirand trace strike straddle the comparison boundary, e.g.Dip_dir = "NW"with a trace striking 020 deg, orDip_dir = "NE"with a trace striking 350 deg. Both are ordered contrary to the convention the code is trying to enforce.Suggested direction: Needs a convention decision from someone who knows the CFM data, so no PR is attached. The standard form is to reverse when the signed angular difference between
compass_direction.valueandstrike + 90exceeds 90 deg, computed modulo 360 — e.g.if ((compass_direction.value - (strike + 90) + 180) % 360) - 180 > 90. Worth confirming against the CFM shapefile whetherDip_diris authoritative or advisory, and whether the four diagonal values are the only ones that occur. Related: the strike comparisons at:476(companion issue).Confidence: high