From e8d324c3f7ffd56bc4d03be9fca5315cd1b47e77 Mon Sep 17 00:00:00 2001 From: Chris Chamberlain Date: Thu, 21 Apr 2022 15:18:32 +1200 Subject: [PATCH] configs as per SRWG #2 --- doc/process/openquake_processes.md | 6 ++++++ docker/runzi-openquake/Dockerfile | 4 ++++ docker/runzi-openquake/README.md | 1 + runzi/execute/util/oq_build_sources.py | 20 ++++++++++---------- runzi/execute/util/oq_hazard_config.py | 8 +++++--- 5 files changed, 26 insertions(+), 13 deletions(-) diff --git a/doc/process/openquake_processes.md b/doc/process/openquake_processes.md index d436c855..e3d055e4 100644 --- a/doc/process/openquake_processes.md +++ b/doc/process/openquake_processes.md @@ -19,5 +19,11 @@ - see `run_oq_convert_solutionhazard.py` below +**Save an arbritrary file** + +``` +python3 runzi/automation/run_save_file_archive.py ~/Downloads/Floor_ADDTOT346ave-base.xml -t BG_Kiran_Floor_ADDTOT346ave-base +``` + diff --git a/docker/runzi-openquake/Dockerfile b/docker/runzi-openquake/Dockerfile index a11cbaab..8b4278f0 100644 --- a/docker/runzi-openquake/Dockerfile +++ b/docker/runzi-openquake/Dockerfile @@ -5,6 +5,10 @@ FROM openquake/engine:latest USER root + +ADD nzshm-oq-engine-main/openquake/hazardlib/scalerel/cscaling.py /opt/openquake/lib/python3.8/site-packages/openquake/hazardlib/scalerel + + RUN apt-get update RUN apt-get install git -y RUN apt-get install nano diff --git a/docker/runzi-openquake/README.md b/docker/runzi-openquake/README.md index 032d3663..c8193a22 100644 --- a/docker/runzi-openquake/README.md +++ b/docker/runzi-openquake/README.md @@ -48,6 +48,7 @@ docker run -u root -it --rm \ ``` docker run -it --rm -u root \ +--memory=52g --memory-swap=52g --oom-kill-disable \ --net=host --env-file environ \ -v $HOME/.aws/credentials:/home/openquake/.aws/credentials:ro \ -v $(pwd)/../../runzi/cli/config/saved_configs:/app/nzshm-runzi/runzi/cli/config/saved_configs \ diff --git a/runzi/execute/util/oq_build_sources.py b/runzi/execute/util/oq_build_sources.py index 3db28558..733a11ca 100644 --- a/runzi/execute/util/oq_build_sources.py +++ b/runzi/execute/util/oq_build_sources.py @@ -80,7 +80,7 @@ def build_sources_xml(logic_tree_branches, source_file_mapping): for branch in logic_tree_branches: files = "" - branch_name = ", ".join([x[0] for x in branch]) + branch_name = "|".join([x[0] for x in branch]) for source_tuple in branch: #print(source_tuple) name, src_id = source_tuple @@ -99,7 +99,7 @@ def build_sources_xml(logic_tree_branches, source_file_mapping): permutations = [ { "CR": { - "CR_N2.3_b0.807_C4.2_s1": "SW52ZXJzaW9uU29sdXRpb25Ocm1sOjEwMjE4MA==", + "CR_N2.3_b0.807_C4.2_s1": "SW52ZXJzaW9uU29sdXRpb25Ocm1sOjEwMjE4MA==" "CR_N8.0_b1.115_C4.1_s1": "SW52ZXJzaW9uU29sdXRpb25Ocm1sOjEwMjE3Nw==", "CR_N2.3_b0.807_C4.1_s1": "SW52ZXJzaW9uU29sdXRpb25Ocm1sOjEwMjE3OQ==", "CR_N3.7_b0.929_C4.2_s1": "SW52ZXJzaW9uU29sdXRpb25Ocm1sOjEwMjE4MQ==", @@ -114,11 +114,11 @@ def build_sources_xml(logic_tree_branches, source_file_mapping): "HTL_b0.97_N11.6_C4_s1": "SW52ZXJzaW9uU29sdXRpb25Ocm1sOjEwMjE3Mw==", "HTL_b1.3_N49.4_C4_s1": "SW52ZXJzaW9uU29sdXRpb25Ocm1sOjEwMjE3Mg==" }, - # "BG": { - # "floor_addtot346ave": "FILL IN THE BLANK" - # }, + "BG": { + "BG_floor_addtot346ave": "RmlsZToxMDIyMzA=" + }, "PY": { - "P_b0.75, N3.4_C3.9_s1": "SW52ZXJzaW9uU29sdXRpb25Ocm1sOjEwMjE3Ng==" + "PY_b0.75_N3.4_C3.9_s1": "SW52ZXJzaW9uU29sdXRpb25Ocm1sOjEwMjE3Ng==" } }, { @@ -135,11 +135,11 @@ def build_sources_xml(logic_tree_branches, source_file_mapping): "HTL_b1.3_N49.4_C4.1_s1": "SW52ZXJzaW9uU29sdXRpb25Ocm1sOjEwMjE3NQ==", "HTL_b0.97_N11.6_C4.1_s1": "SW52ZXJzaW9uU29sdXRpb25Ocm1sOjEwMjE3NA==" }, - # "BG": { - # #"floor_addtot346ave": "FILL IN THE BLANK" - # }, + "BG": { + "BG_floor_addtot346ave": "RmlsZToxMDIyMzA=" + }, "PY": { - "P_b0.75_N3.4_C3.9_s1": "SW52ZXJzaW9uU29sdXRpb25Ocm1sOjEwMjE3Ng==" + "PY_b0.75_N3.4_C3.9_s1": "SW52ZXJzaW9uU29sdXRpb25Ocm1sOjEwMjE3Ng==" } } ] diff --git a/runzi/execute/util/oq_hazard_config.py b/runzi/execute/util/oq_hazard_config.py index cb64e9f8..4e9ff0b5 100644 --- a/runzi/execute/util/oq_hazard_config.py +++ b/runzi/execute/util/oq_hazard_config.py @@ -125,14 +125,16 @@ def write(self, tofile): nc = OpenquakeConfig(sample)\ .set_sites('NZ4')\ - .set_disaggregation(True, {"num_rlz_disagg": 0}) + .set_disaggregation(False, {"num_rlz_disagg": 0}) measures = ['PGA', 'SA(0.5)'] levels0 = [0.01, 0.02, 0.04, 0.06, 0.08, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.2, 1.4, 1.6, 1.8, 2.0, 2.2, 2.4, 2.6, 2.8, 3.0, 3.5, 4, 4.5, 5.0] levels1 = 'logscale(0.005, 4.00, 30)' + _4_sites_levels = [0.01, 0.02, 0.04, 0.06, 0.08, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.2, 1.4, 1.6, 1.8, 2.0, 2.2, 2.4, 2.6, 2.8, 3.0, 3.5, 4, 4.5, 5.0] + _4_sites_measures = ['PGA',"SA(0.1)","SA(0.2)","SA(0.3)","SA(0.4)","SA(0.5)","SA(0.7)","SA(1.0)","SA(1.5)","SA(2.0)","SA(3.0)","SA(4.0)","SA(5.0)"] - nc.set_iml(measures, levels1) - nc.set_vs30(355) + nc.set_iml(_4_sites_measures, _4_sites_levels) + nc.set_vs30(250) out = io.StringIO() #aother fake file nc.write(out)