Skip to content

Support nshmdb's fault_system-scoped rupture/fault lookups - #148

Merged
lispandfound merged 6 commits into
pegasusfrom
support-new-nshmdb-fault-system-api
Sep 2, 2026
Merged

Support nshmdb's fault_system-scoped rupture/fault lookups#148
lispandfound merged 6 commits into
pegasusfrom
support-new-nshmdb-fault-system-api

Conversation

@AndrewRidden-Harper

@AndrewRidden-Harper AndrewRidden-Harper commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Summary

  • nshmdb 2026.8.x merges Hikurangi/Puysegur/Crustal into one rupture_id space; get_rupture_faults/get_rupture_fault_info need fault_system alongside the NSHM id, and most_likely_fault takes a 3rd positional arg. generate_realisation gains an optional fault_system option (default Crustal, this project's only fault system so far), threaded through all three call sites.
  • Also calls db.connect() explicitly — NSHMDB.connection() now raises unless the connection was opened via connect()/__enter__ first; the old package connected implicitly.
  • Depends on Fix get_rupture_faults/get_rupture_fault_info to take fault_system NSHM2022DB#38 (get_rupture_faults/get_rupture_fault_info don't accept fault_system yet on any released nshmdb version — this PR's diff won't type/behave correctly against pegasus's currently-locked 2026.8.3 until that one merges and releases). Opened as a draft for that reason.

🤖 Generated with Claude Code

AndrewRidden-Harper and others added 4 commits September 1, 2026 22:35
nshmdb 2026.8.x merges Hikurangi/Puysegur/Crustal into one rupture_id
space and requires fault_system alongside the NSHM id for
get_rupture_faults/get_rupture_fault_info (NSHM2022DB PR pending -- see
fix-fault-system-scoping-in-rupture-fault-lookups), and a 3rd positional
arg on most_likely_fault. generate_realisation gains an optional
fault_system option, defaulting to Crustal (this project's only fault
system so far), threaded through all three call sites.

Also calls db.connect() explicitly -- NSHMDB.connection() now raises
unless the connection was opened via connect()/__enter__ first; the old
package connected implicitly.

Verified end-to-end against nshmdb_v2026.08.3.db (rupture 3): faults
grouped and named correctly, rakes preserved.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The parenthetical sat after "NSHM id", reading as if the id were a
FaultSystem. The id is a plain int; FaultSystem is already the declared
type of the parameter itself.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@AndrewRidden-Harper
AndrewRidden-Harper marked this pull request as ready for review September 1, 2026 11:11
lispandfound
lispandfound previously approved these changes Sep 2, 2026
Conflict in workflow/scripts/nshm2022_to_realisation.py: "Update CI (#135)"
independently adapted the most_likely_fault call to nshmdb 2026.8.3's new
leading fault_system argument by hardcoding nshmdb.FaultSystem.Crustal, while
this branch threads the value through from the new --fault-system option.
Kept pegasus's multi-line call layout (and the ty ignore on the magnitudes
argument, still needed since most_likely_fault declares dict[str, float])
with fault_system in place of the hardcoded literal.

Everything else merged cleanly: pegasus's dict(faults) invariance casts and
this branch's db.connect()/fault_system lookups sit in disjoint hunks, and
uv.lock's textual merge is consistent (uv lock --check passes).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019GHytYmpgE1CqWVKbzYWKe
@lispandfound
lispandfound merged commit b9f035a into pegasus Sep 2, 2026
5 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.

2 participants