Skip to content

Commit

Permalink
Merge pull request #7 from GNS-Science/feature/serialise_model_1.0.4
Browse files Browse the repository at this point in the history
Add enriched json for the new NSHM_1.0.4 version
  • Loading branch information
chrisbc authored Apr 3, 2023
2 parents bae4b96 + 03f7f5f commit b89b73d
Show file tree
Hide file tree
Showing 12 changed files with 2,693 additions and 143 deletions.
5 changes: 2 additions & 3 deletions nzshm_model/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from . import nshm_1_0_0
from . import nshm_1_0_4
from . import nshm_1_0_0, nshm_1_0_4

# Python package version is different than the NSHM MODEL version !!
__version__ = '0.1.1'
Expand All @@ -9,7 +8,7 @@
versions = {
"NSHM_1.0.0": nshm_1_0_0,
"NSHM_1.0.4": nshm_1_0_4,
}
}


def get_model_version(version_id):
Expand Down
11 changes: 5 additions & 6 deletions nzshm_model/nshm_1_0_4.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
#! v1_0_0.py
#! nshm_v1_0_4.py

import itertools
import json
from pathlib import Path

import dacite # for dataclass reconstitution

import nzshm_model.source_logic_tree.SLT_v8_gmm_v2_final as slt_config # NOQA F401
from nzshm_model.source_logic_tree.slt_config import from_config
import nzshm_model.source_logic_tree.SLT_v9p0p0 as slt_config # NOQA F401
from nzshm_model.source_logic_tree.logic_tree import SourceLogicTree

version = 'NSHM_1.0.4'
title = "NSHM version 1.0.4, corrected fault geometry"

py_slt = Path(__file__).parent / "source_logic_tree" / "SLT_v9p0p0.py"
json_slt = Path(__file__).parent / "source_logic_tree" / "SLT_v9p0p0.json"


def source_logic_tree():
return from_config(py_slt, version, title)
return dacite.from_dict(data_class=SourceLogicTree, data=json.load(open(json_slt)))
2 changes: 1 addition & 1 deletion nzshm_model/source_logic_tree/SLT_v8.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "SLT_v8",
"version": "NSHM_1.0.0",
"title": "",
"fault_system_lts": [
{
Expand Down
Loading

0 comments on commit b89b73d

Please sign in to comment.