Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ dependencies = [
"nshmdb>=2026.09.1",
"oq_wrapper>=2025.12.3",
"qcore-utils>=2025.12.2",
"site-calculation>=2026.7.1",
"source_modelling>=2026.08.1",
# Data Formats
"geopandas",
Expand Down Expand Up @@ -141,6 +142,7 @@ known-first-party = [
"IM",
"mera",
"velocity_modelling",
"site_calculation",
]

[tool.ruff.lint.per-file-ignores]
Expand Down
13 changes: 10 additions & 3 deletions tests/test_realisation.py
Original file line number Diff line number Diff line change
Expand Up @@ -604,16 +604,23 @@ def test_emod3d(tmp_path: Path) -> None:
def test_broadband_parameters(tmp_path: Path) -> None:
test_realisation = tmp_path / "realisation.json"
broadband_parameters = realisations.BroadbandParameters(
flo=0.5, fmidbot=0.5, fmin=0.25, site_amp_version="2014"
flo=0.5,
fmidbot=0.5,
fmin=0.2,
fhightop=100.0,
fmax=101.0,
site_amp_version=schemas.SiteAmpModel.BA2018,
)
broadband_parameters.write_to_realisation(test_realisation)
with open(test_realisation, "r") as realisation_handle:
assert json.load(realisation_handle) == {
"bb": {
"flo": 0.5,
"fmidbot": 0.5,
"fmin": 0.25,
"site_amp_version": "2014",
"fmin": 0.2,
"fhightop": 100.0,
"fmax": 101.0,
"site_amp_version": "ba2018",
}
}
assert (
Expand Down
27 changes: 27 additions & 0 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions workflow/default_parameters/root/defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1526,3 +1526,9 @@ hf_velocity_model_1d:
rho: 3.33
Qp: 394.80
Qs: 197.40
bb:
fmin: 0.2
fmidbot: 0.5
fhightop: 100.0
fmax: 101.0
site_amp_version: "ba2018"
3 changes: 0 additions & 3 deletions workflow/default_parameters/v24_2_2_1/defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,3 @@ resolution:
resolution: 0.1
bb:
flo: 1.0
fmidbot: 0.5
fmin: 0.25
site_amp_version: "2014"
3 changes: 0 additions & 3 deletions workflow/default_parameters/v24_2_2_2/defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,3 @@ resolution:
resolution: 0.2
bb:
flo: 0.5
fmidbot: 0.5
fmin: 0.25
site_amp_version: "2014"
3 changes: 0 additions & 3 deletions workflow/default_parameters/v24_2_2_4/defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,3 @@ resolution:
resolution: 0.4
bb:
flo: 0.25
fmidbot: 0.5
fmin: 0.25
site_amp_version: "2014"
3 changes: 0 additions & 3 deletions workflow/default_parameters/v26_7_1Hz/defaults.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
---
bb:
flo: 1.0
fmidbot: 0.5
fmin: 0.2
site_amp_version: "ba2018"
velocity_model:
# Overrides the root default of 2.0 km, which is an EMOD3D value and has no
# absorbing layer to clear. Two criteria bear on this number, and only the
Expand Down
11 changes: 8 additions & 3 deletions workflow/realisations.py
Original file line number Diff line number Diff line change
Expand Up @@ -1001,7 +1001,7 @@


@dataclasses.dataclass
class NZCVMSettings(RealisationConfiguration):

Check failure on line 1004 in workflow/realisations.py

View workflow job for this annotation

GitHub Actions / ci / ruff

ruff (D101)

workflow/realisations.py:1004:7: D101 Missing docstring in public class

Check failure on line 1004 in workflow/realisations.py

View workflow job for this annotation

GitHub Actions / ci / ruff

ruff (D101)

workflow/realisations.py:1004:7: D101 Missing docstring in public class
_config_key: ClassVar[str] = "nzcvm"
_schema: ClassVar[Schema] = schemas.NZCVM_SCHEMA

Expand Down Expand Up @@ -1366,10 +1366,15 @@
flo: float
"""low/high frequency cutoff."""
fmidbot: float
"""fmidbot for site amplification"""
"""fmidbot for the site amplification lowpass taper."""
fmin: float
"""fmin for site amplification."""
site_amp_version: str
"""fmin for the site amplification lowpass taper."""
fhightop: float
"""fhightop for the site amplification highpass taper."""
fmax: float
"""fmax for the site amplification highpass taper."""
site_amp_version: schemas.SiteAmpModel
"""The site amplification model to apply."""


@dataclasses.dataclass
Expand Down Expand Up @@ -1402,7 +1407,7 @@
parts.append(f"{key}={value}")
return " ".join(parts)

def merged(self, **overrides: str | int | float | bool | None) -> "SW4Command":

Check failure on line 1410 in workflow/realisations.py

View workflow job for this annotation

GitHub Actions / ci / ruff

ruff (PYI041)

workflow/realisations.py:1410:35: PYI041 Use `float` instead of `int | float` help: Remove redundant type

Check failure on line 1410 in workflow/realisations.py

View workflow job for this annotation

GitHub Actions / ci / ruff

ruff (PYI041)

workflow/realisations.py:1410:35: PYI041 Use `float` instead of `int | float` help: Remove redundant type
"""Return a copy of this command with `overrides` merged into its parameters.

Parameters
Expand Down
15 changes: 14 additions & 1 deletion workflow/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ class Stype(StrEnum):
seki = "seki"


class SiteAmpModel(StrEnum):
"""Site amplification models for broadband simulation."""

CB2014 = "cb2014"
BA2018 = "ba2018"


class KModel(IntEnum):
"""Correlation length models for genslip."""

Expand Down Expand Up @@ -1168,7 +1175,13 @@ def _corners_to_array(corners_spec: list[dict[str, float]]) -> np.ndarray:
Literal("fmin", description="fmin for site amplification"): And(
NUMBER, _is_non_negative
),
"site_amp_version": str,
Literal("fhightop", description="fhightop for site amplification"): And(
NUMBER, _is_non_negative
),
Literal("fmax", description="fmax for site amplification"): And(
NUMBER, _is_non_negative
),
"site_amp_version": Use(SiteAmpModel),
}
)

Expand Down
Loading
Loading