diff --git a/pyproject.toml b/pyproject.toml index 9c1b66e8..c7a65d2d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,7 +13,7 @@ dependencies = [ # UCGMSim Dependencies "im-calculation>=2025.12.5", "velocity-modelling>=2026.2.1", - "nshmdb>=2025.12.1", + "nshmdb>=2026.09.1", "oq_wrapper>=2025.12.3", "qcore-utils>=2025.12.2", "source_modelling>=2026.08.1", diff --git a/uv.lock b/uv.lock index f04799b2..21e90bda 100644 --- a/uv.lock +++ b/uv.lock @@ -1731,7 +1731,7 @@ wheels = [ [[package]] name = "nshmdb" -version = "2026.8.3" +version = "2026.9.1" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "duckdb" }, @@ -1746,9 +1746,9 @@ dependencies = [ { name = "source-modelling" }, { name = "typer" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/30/0c/dbcac49e61d6a4e8f0dd460d3dab376c3978a79f003294e7b47d8b153c11/nshmdb-2026.8.3.tar.gz", hash = "sha256:0fb515ba8c6c8410084a14632faa9339a90082f90d60c6cecd7dfb33adf582f9", size = 200264, upload-time = "2026-08-20T04:34:39.836Z" } +sdist = { url = "https://files.pythonhosted.org/packages/66/5b/e6ea2fd119b58a2b1aa3a4616de0ee34356ac62dece7887398f6f7603260/nshmdb-2026.9.1.tar.gz", hash = "sha256:c89ed5c351d71000a0486515d9c0ffe94083a41b299a566119e44b20d1c3ca6b", size = 200270, upload-time = "2026-09-02T00:28:32.238Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/a6/19/0636161438be7f33ef107f475470981831d303fae2ecd33a20101cffbd7b/nshmdb-2026.8.3-py3-none-any.whl", hash = "sha256:f919ecffe74de270534e3c42455de2ce89f8826f48bf27c3dd33ca91821d8a8d", size = 20998, upload-time = "2026-08-20T04:34:38.378Z" }, + { url = "https://files.pythonhosted.org/packages/d0/3c/da88ebde8c67962ced54ca49f9c66ae6cd059b58418051d79a1b9fab4cdc/nshmdb-2026.9.1-py3-none-any.whl", hash = "sha256:afb2055836fb89eb6ded94daf6c618cba9777d628cf85e289d46242da3d6dea0", size = 20998, upload-time = "2026-09-02T00:28:30.803Z" }, ] [[package]] @@ -3520,7 +3520,7 @@ requires-dist = [ { name = "geopandas" }, { name = "hypothesis", extras = ["numpy"], marker = "extra == 'test'", specifier = ">=6.0.0" }, { name = "im-calculation", specifier = ">=2025.12.5" }, - { name = "nshmdb", specifier = ">=2025.12.1" }, + { name = "nshmdb", specifier = ">=2026.9.1" }, { name = "numpy" }, { name = "numpydoc", marker = "extra == 'dev'" }, { name = "oq-wrapper", specifier = ">=2025.12.3" }, diff --git a/workflow/scripts/nshm2022_to_realisation.py b/workflow/scripts/nshm2022_to_realisation.py index db6b8b54..ecf0ece3 100755 --- a/workflow/scripts/nshm2022_to_realisation.py +++ b/workflow/scripts/nshm2022_to_realisation.py @@ -45,6 +45,7 @@ from scipy.cluster.hierarchy import DisjointSet from nshmdb import nshmdb +from nshmdb.nshmdb import FaultSystem from qcore import cli from qcore.uncertainties import distributions from source_modelling import magnitude_scaling, moment, rupture_propagation, sources @@ -187,6 +188,7 @@ def generate_realisation( DefaultsVersion, typer.Argument(), ], + fault_system: Annotated[FaultSystem, typer.Option()] = FaultSystem.Crustal, initial_fault: Annotated[ str | None, typer.Option(), @@ -252,6 +254,10 @@ def generate_realisation( Location to write out the realisation. defaults_version : DefaultsVersion Scientific default parameters version to use. + fault_system : FaultSystem, optional + The NSHM fault system rupture_id belongs to. Defaults to Crustal. + rupture_id is an NSHM id, unique only within one fault system, not + a database primary key. initial_fault : str, optional The name of the fault to use as the initial fault for rupture propagation. If not specified, the initial fault will be drawn @@ -311,7 +317,8 @@ def generate_realisation( realisation_ffp, defaults_version ) db = nshmdb.NSHMDB(nshmdb_path) - faults = db.get_rupture_faults(rupture_id) + db.connect() + faults = db.get_rupture_faults(fault_system, rupture_id) faults = { fault_name: sources.simplify_fault(fault, srf_config.resolution) for fault_name, fault in faults.items() @@ -322,7 +329,7 @@ def generate_realisation( f"Initial fault '{initial_fault}' not found in rupture. Options are {', '.join(list(faults))}" ) raise typer.Exit(code=1) - faults_info = db.get_rupture_fault_info(rupture_id) + faults_info = db.get_rupture_fault_info(fault_system, rupture_id) seeds = Seeds.read_from_realisation_or_random(realisation_ffp) np.random.seed(seed=seeds.nshm_to_realisation_seed) random.seed(seeds.nshm_to_realisation_seed) @@ -355,7 +362,7 @@ def generate_realisation( # The ty ignore below can be removed once NSHM2022DB merges the change to # accept dict[str, BoldM] in most_likely_fault (branch support-BoldM-in-workflow). mfds_rates = db.most_likely_fault( - nshmdb.FaultSystem.Crustal, + fault_system, rupture_id, magnitudes, # ty: ignore[invalid-argument-type] )