-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Doc/nshm model relational.md #11
base: main
Are you sure you want to change the base?
Changes from all commits
e5a0fee
2937c2e
133c127
28db96b
a7ff684
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
???+ warning "Nov 2023 - this is model under active revision !!" | ||
|
||
## Introduction | ||
|
||
These are databases of related hazard curves each associated with a specific combination of Sources and GMMs. | ||
|
||
|
||
## Seismic Hazard Model diagram | ||
|
||
|
||
|
||
```mermaid | ||
classDiagram | ||
direction LR | ||
|
||
class HazardModelRealisation { | ||
vs30s() integer | ||
LocationList() string[] | ||
IMTList() string[] | ||
hazardCurve(vs30, IMT, Location) | ||
} | ||
|
||
class HazardCurveResult { | ||
vs30() string | ||
Location() string | ||
IMT() string | ||
curves() float[] | ||
} | ||
|
||
SeismicHazardModel -- "0..*" HazardModelRealisation | ||
HazardModelRealisation -- "0..*" HazardCurveResult | ||
``` | ||
|
||
???+ "Accessing the NSHM hazard realisations" | ||
|
||
The NZ NSHM project makes Hazard Model Realisations available via a graphql web API. There is also a python client library that wraps the web API and also allows the user to cache results locally for better performance in many situations. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this true? We use THS to store/retrieve component realizations. The composite realizations are not kept (at the moment). |
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# NSHM Domain Model | ||
|
||
Diagrams depicting the Conceptual model of the NSHM project including both behavior and data. See also [Wikipedia](https://en.wikipedia.org/wiki/Domain_model). | ||
|
||
We use UML Class modelling techniques to explaing the Information used within the NZ NSHM ecosystem. Our diagrams use Mermaid, whcih makes them diagram-as-code | ||
|
||
## Table of contents | ||
|
||
- [Seismic Hazard Model](./seismic_hazard_model.md) | ||
- [Hazard Realisations](./hazard_realisation_model.md) | ||
- [Misc](./relational.md) working stuff |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
# NZSHM-Model relationships | ||
|
||
This is parked, it contains some developmental diagrams used to infotm the wider class modelling. | ||
|
||
## Toshi Hazard objects (Task + Solution + Config) | ||
|
||
```mermaid | ||
classDiagram | ||
|
||
%% direction LR | ||
class OpenquakeHazardSolution { | ||
<<Node>> | ||
String id: | ||
String produced_by: | ||
config | ||
template | ||
File hazard_solution_csv_archive | ||
File hazard_solution_hdf5_archive | ||
|
||
} | ||
|
||
class OpenquakeHazardTask { | ||
<<Node>> | ||
String id: | ||
node hazard_solution | ||
model_type | ||
logic_tree_permutations | ||
intensity_spec | ||
vs30 | ||
String[] location_list | ||
node template_archive | ||
hazard_config | ||
source_models | ||
} | ||
|
||
class OpenquakeHazardConfig { | ||
<<Node>> | ||
Node[] source_models | ||
template_archive | ||
} | ||
|
||
OpenquakeHazardTask "*" -- "1" OpenquakeHazardConfig | ||
OpenquakeHazardTask "1" -- "0..1" OpenquakeHazardSolution | ||
|
||
note for OpenquakeHazardSolution "T3BlbnF1YWtlSGF6YXJkU29sdXRpb246NjUzNjk0MQ==" | ||
note for OpenquakeHazardTask "T3BlbnF1YWtlSGF6YXJkVGFzazo2NTM2ODgx" | ||
|
||
``` | ||
|
||
## OQ hazard processing | ||
|
||
```mermaid | ||
classDiagram | ||
|
||
direction TB | ||
|
||
class SourceLogicTreeBranch | ||
class GroundMotionLogicTreeBranch | ||
|
||
class OpenquakeHazardSolution { | ||
vs30 | ||
} | ||
|
||
class THS_OpenquakeMeta { | ||
<<DynamoDB Row>> | ||
String toshi_hazard_solution_id | ||
etc | ||
} | ||
|
||
class THS_OpenquakeRealization { | ||
<<DynamoDB Row>> | ||
toshi_hazard_solution_id | ||
location_code | ||
rlz_id | ||
vs30 | ||
hazard_curves | ||
} | ||
|
||
class Realization { | ||
Integer id | ||
string[] imts | ||
float[] poes | ||
} | ||
|
||
|
||
|
||
THS_OpenquakeRealization -- THS_OpenquakeMeta | ||
THS_OpenquakeRealization *-- Realization | ||
|
||
Realization "1" -- "1..*" OpenquakeHazardSolution | ||
|
||
SourceLogicTreeBranch -- Realization | ||
GroundMotionLogicTreeBranch -- Realization | ||
|
||
|
||
``` | ||
|
||
## Not needed | ||
|
||
``` | ||
%% HDF5 -- THS_meta | ||
%% HDF5 "1" -- "*" RLZ | ||
|
||
%% OHT --|> "produces" HDF5 | ||
class HDF5["Openquake_HDF5"] { | ||
<<File>> | ||
realizations | ||
hazard_curves | ||
} | ||
class SLTC_VL["SLTC_VS30_Location"] { | ||
+Int vs30 | ||
+String location_code | ||
} | ||
|
||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
## Introduction | ||
|
||
The NZ NSHM project publishes **Seismic Hazard Model** versions in the [GNS_Science/nzshm-model]() github repository. | ||
|
||
Models may be Published or Partial. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd go with Published or Unpublished |
||
|
||
- Published models are for use by 3rd parties e.g. `NSHM_v1.0.4`. | ||
- Partial/Unpublished models are typically used for comparisons against complete models, e.g sensitivity tests. They usually are most informative when compared to a published model. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "Unpublished models are typically used for scientific experimentation, e.g. sensitivity tests or testing new concepts." |
||
|
||
## Seismic Hazard Model diagram | ||
|
||
```mermaid | ||
classDiagram | ||
direction LR | ||
|
||
SeismicHazardModel *-- "1" SourceLogicTree | ||
SeismicHazardModel *-- "1" GroundMotionModelLogicTree | ||
|
||
class SeismicHazardModel { | ||
version() string a unique string identifying the model | ||
notes() string more details on this particular model | ||
} | ||
|
||
class HazardModelRealisation { | ||
vs30s() integer | ||
LocationList() string[] | ||
IMTList() string[] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add |
||
hazardCurve(vs30, IMT, Location) | ||
} | ||
|
||
class HazardCurveResult { | ||
vs30() string | ||
Location() string | ||
IMT() string | ||
curves() float[] | ||
} | ||
|
||
SeismicHazardModel -- "0..*" HazardModelRealisation | ||
HazardModelRealisation -- "0..*" HazardCurveResult | ||
``` | ||
|
||
## The Source Logic Tree hierarchy | ||
|
||
A SourceLogicTree structure describes the 'source' components of the model. Each **SeismicHazardModel** must contain a fully populated **SourceLogicTree**. | ||
|
||
A **SourceLogicTree** is further composed of a hierarchy of **SourceLogicTreeGroup**, **SourceLogicTreeBranch** and **SourceLogicTreeSource** objects. | ||
|
||
|
||
```mermaid | ||
classDiagram | ||
direction LR | ||
|
||
SourceLogicTree *-- "1..*" SourceLogicTreeGroup | ||
SourceLogicTreeGroup *-- "1..*" SourceLogicTreeBranch | ||
SourceLogicTreeBranch "0..*" -- "1..*" SourceLogicTreeSource | ||
|
||
class SourceLogicTree { | ||
version() string | ||
notes() string | ||
} | ||
|
||
class SourceLogicTreeGroup { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could we make our terminology less of a mounthful by using SRM instead of Source? Though, this may then not match with what we've done in nzshm-model (does that matter?) |
||
group() string e.g `Hik, Puy` | ||
tectonic_region() string e.g. `Slab, Crustal` | ||
check_branch_weights() boolean | ||
} | ||
|
||
class SourceLogicTreeBranch { | ||
weight() float | ||
tag() string e.g. `Hik TL, N16.5, b0.95, C4, s0.42` | ||
} | ||
|
||
class SourceLogicTreeSource { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't like the nomenclature that uses "Source" twice. What if we changed |
||
tag() string e.g. `Hik TL, N16.5, b0.95, C4, s0.42, IFM` | ||
} | ||
``` | ||
|
||
???+ note "NSHM SourceLogicTreeGroups" | ||
|
||
In `NSHM_v1.0.4` the model contains 4 SourceLogicTreeGroups: one each for Crustal, Hikurangi, Puysegur and Slab sources. | ||
|
||
Each SourceLogicTreeSource is a re-useable arrangment of fault sources, so these are uniquely identified to support reuse in independent **Seismic Hazard Models**. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we follow the above change to Source then this could be changed to: |
||
|
||
|
||
## Types of Source Logic Tree Source. | ||
|
||
NSHM and many other SeismicHazardModels will include different types of SourceLogicTreeSource model. | ||
|
||
In NZ NSHM we have three ... | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this is too specific and restrictive. We can describe in generic terms that we can combine Source objects or have just a single one to create a SourceLogicTreeBranch. We can use the current model as an example of how sources are split by region and/or TRT and that some have multiple contributions (IFM + DSM) and others are just a DSM |
||
|
||
- Crustal sources usually contain a fault source model NRML and a distributed/gridded source NRML. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Crustal and SubductionInterface sources . . . |
||
For NSHM Crustal sources it is helpful to know both the RuptureSet and the inversoin source model as well. | ||
- Subduction sources contain a single fault source describing the ruptures that can occur across the subduction fault system. | ||
- A single Slab source that describes source rates occuring in the interface region (25-) | ||
|
||
We use the NRML (XML) file format for SourceLogicTreeSource sources. This format is required to run hazard calculation in Openquake, and it's well known throughout our user community. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is now a combination of XML and hdf5 |
||
|
||
???+ warning "Nov 2023 - this is model under active revision !!" | ||
|
||
```mermaid | ||
classDiagram | ||
|
||
direction TB | ||
|
||
SourceLogicTreeSource <|-- SubductionSource | ||
SourceLogicTreeSource <|-- SlabSource | ||
SourceLogicTreeSource <|-- CrustalSource | ||
|
||
class SourceLogicTreeSource { | ||
tag() string e.g. Hik TL, N16.5, b0.95, C4, s0.42, IFM | ||
} | ||
|
||
class CrustalSource { | ||
source_id() string get the source identifier | ||
on_fault_nrml() string get the on_fault_source NRML | ||
gridded_nrml() string get the gridded source NRML | ||
} | ||
|
||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
|
||
## Toshi Hazard objects (Task + Solution + Config) | ||
```mermaid | ||
|
||
classDiagram | ||
|
||
|
||
class OHT["Openquake Hazard Task"] { | ||
<<AutomationTaskInterface, Node>> | ||
config "The task configuration" | ||
hazard_solution "The openquake solution" | ||
|
||
model_type enum CRUSTAL, SUBDUCTION, COMPOSITE | ||
task_type enum HAZARD, DISAGG, UNDEFINED | ||
} | ||
|
||
class OHS["Openquake Hazard Solution"] { | ||
<<PredecessorsInterface, Node>> | ||
created "When it was created UTZ" | ||
metrics "result metrics ... a list of Key Value pairs." | ||
meta "metadata... a list of Key Value pairs." | ||
produced_by "The task that produced this solution" | ||
task_args = "task arguments json file." | ||
|
||
config "the template configuration used to produce this solution" | ||
modified_config = "a zip archive containing modified config files." | ||
csv_archive = "zip archive containing hazard csv outputs `oq engine --export-outputs ....`" | ||
hdf5_archive "a zip of the raw hdf5" | ||
|
||
|
||
} | ||
|
||
|
||
class OHC["Openquake Hazard Config"] { | ||
<<Node>> | ||
nodeId[] source_models "List of Source NRML files" | ||
nodeId template_archive "archive of all the additional config files" | ||
} | ||
|
||
OHT "*" -- "1" OHC | ||
OHS "*" -- "1" OHC | ||
OHT "1" -- "0..1" OHS | ||
|
||
note for OHS "T3BlbnF1YWtlSGF6YXJkU29sdXRpb246NjUzNjk0MQ==" | ||
note for OHT "T3BlbnF1YWtlSGF6YXJkVGFzazo2NTM2ODgx" | ||
|
||
``` | ||
|
||
### crumbs | ||
``` | ||
class OHT1["Openquake Hazard Task from pres"] { | ||
<<Node>> | ||
String id: | ||
node hazard_solution | ||
model_type | ||
logic_tree_permutations | ||
intensity_spec | ||
vs30 | ||
String[] location_list | ||
node template_archive | ||
hazard_config | ||
source_models | ||
} | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure I follow the difference between
HazardModelRealization
andHazardCurveResult