Skip to content

data

HazardCurves

A class for retrieving and storing hazard curves and calculating derived products.

__init__(loader: HazardLoader)

Initialize a new HazardCurves object.

Parameters:

Name Type Description Default
loader HazardLoader

The data loader to use to retrive hazard curves.

required

get_hazard_curve(hazard_model_id: str, imt: str, location: CodedLocation, vs30: int, agg: str) -> tuple[npt.NDArray, npt.NDArray]

Get a single hazard curve.

Parameters:

Name Type Description Default
hazard_model_id str

The identifier of the hazard model. Specific use will depend on the DataLoader type.

required
imt str

The intesity measure type (e.g. "PGA", "SA(1.0)").

required
location CodedLocation

The site location for the hazard curve.

required
vs30 int

The vs30 of the site.

required
agg str

The statistical aggregate curve (e.g. "mean", "0.1") where fractions represent fractile curves.

required

Returns:

Type Description
tuple[npt.NDArray, npt.NDArray]

A tuple (imtls, poes) where imtls is the shaking levels and poes is the probability of exceedance values.

get_uhs(hazard_model_id: str, poe: float, imts: list[str], location: CodedLocation, vs30: int, agg: str) -> tuple[npt.NDArray, npt.NDArray]

Get the uniform hazard spectrum (UHS) for a site.

The period for peak IMTs (e.g. "PGA", "PGV") is 0.

Parameters:

Name Type Description Default
hazard_model_id str

The identifier of the hazard model. Specific use will depend on the DataLoader type.

required
poe float

The probablity of exceedance at which to calculate the UHS.

required
imts list[str]

The intesity measure types / periods at which to caluclate the UHS curve (e.g. ["PGA", "SA(1.0)"]).

required
location CodedLocation

The site location for the UHS.

required
vs30 int

The vs30 of the site.

required
agg str

The statistical aggregate curve (e.g. "mean", "0.1") where fractions represent fractile curves.

required

Returns:

Type Description
npt.NDArray

A tuple (periods, imtls) where periods is the shaking periods (from the imts) and imtls

npt.NDArray

is the shaking levels.

Disaggregations

A class for retrieving and storing disaggregation matrices.

__init__(loader: DisaggLoader)

Initialize a new Disaggregations object.

Parameters:

Name Type Description Default
loader DisaggLoader

The data loader to use to retrive disaggregations.

required

get_disaggregation(hazard_model_id: str, dimensions: Iterable[str], imt: str, location: CodedLocation, vs30: int, poe: ProbabilityEnum, agg: str) -> tuple[dict[str, npt.NDArray], npt.NDArray]

Get a disaggregation matrix.

Available disaggregation dimensions are dictated by what was calculated during processing. Possible dimensions are "trt" (tectonic region type), "mag" (earthquake magnitude), "dist" (distance to source), "eps" (GMM epsilon).

Parameters:

Name Type Description Default
hazard_model_id str

The identifier of the hazard model. Specific use will depend on the DataLoader type.

required
dimensions Iterable[str]

The disaggregation dimensions desired, e.g. ["trt", "mag"]

required
imt str

The intesity measure type (e.g. "PGA", "SA(1.0)").

required
location CodedLocation

The site location for the hazard curve.

required
vs30 int

The vs30 of the site.

required
poe ProbabilityEnum

Probability of exceedance of the disaggregation (point on the hazard curve at which the disaggregation was calculated)

required
agg str

The statistical aggregate curve (e.g. "mean", "0.1") where fractions represent fractile curves.

required

Returns:

Type Description
tuple[dict[str, npt.NDArray], npt.NDArray]

A tuple of (bin_centers, disaggregation probability matrix). The order of the dimensions in bin_centers is the same as the dimensions of the disaggregation probability matrix.

HazardGrids

A class to retrieve hazard grids.

Hazard grids are intensity measure levels (IMTLs) at a particular probability of exceedance for every point on a map grid. They are used to produce "hazard maps".

__init__(loader: GridLoader)

Initialize a new HazardGrids object.

Parameters:

Name Type Description Default
loader GridLoader

The data loader to use to retrive hazard grids.

required

get_grid(hazard_model_id: str, imt: str, grid_name: str, vs30: int, poe: ProbabilityEnum, agg: str) -> npt.NDArray

Get a hazard grid.

Parameters:

Name Type Description Default
hazard_model_id str

The identifier of the hazard model. Specific use will depend on the DataLoader type.

required
imt str

The intesity measure type (e.g. "PGA", "SA(1.0)").

required
grid_name str

A grid name from nzshm_common. Use nzshm_common.grids.get_location_grid_names() to find a list of valid grid names.

required
vs30 int

The vs30 of the sites.

required
poe ProbabilityEnum

Probability of exceedance

required
agg str

The statistical aggregate curve (e.g. "mean", "0.1") where fractions represent fractile curves.

required

Returns:

Type Description
npt.NDArray

The intensity measure levels (IMTLs) at the poe of interest over the grid. The array is 1D and its entries are in the same order as the locations retrieved from nzshm_common.grids.get_location_grid.