Feature: generate openquake job.ini on the fly
Closed this issue · 0 comments
We don't want to use openquake config archives anymore.
- a set of openquake parameters that must be defined by the user (see list below)
- define a set of openquake defaults
- allow user to overwrite defaults
- GMCM logic tree passed as config argument to task
- GMCM logc tree stored/serialized/deserialzied as NrmlDocument type rather than raw text: PARKED see note
- allow user to overwrite
maximum_distance
parameters
Note on GMCM logic tree
ran into problem with dataclass.asdict()
error
RecursionError: maximum recursion depth exceeded while calling a Python object
QUESTION: should there be any oq defaults? It risks that we change them and then there is no easy way to trace/identify that they have changed. If there are no defaults, then all oq settings are stored in the task arguments
Must be defined
imts
imtls
vs30s
- locations
- logic tree
These all fall under level 1 tables
Any other parameters can be set once or iterated through. Indicate they are iterated in the config toml with a level 2 table [iterate.x]
like this:
[iterate.general]
ps_grid_spacings = [15, 30]
[iterate.erf]
rupture_mesh_spacings = [2, 4]
The second table (e.g., general
or erf
) must match the table used in the openquake ini file.
Anything not iterated through by runzi, simply set in openquake is indicated by [single.x]
. E.g.:
[single.calculation]
truncation_level = 3
The difference between ini and toml requires sliglyt differnt style for dictionaries. They will be translated when writing to the ini file.
Example:
[general]
title = "OpenQuake Hazard Calcs"
description = "Logic Tree 9.0.1, locations for cave locations"
[calculation]
num_workers = 4
gsim_logic_tree_file = "/home/chrisdc/NSHM/oqconfigs/01.05.2023/NZ_NSHM_GMM_LT_final_EE.xml"
[hazard_curve]
imts = ['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)', 'SA(6.0)','SA(7.5)', 'SA(10.0)']
imtls = [
0.0001, 0.0002, 0.0004, 0.0006, 0.0008,
0.001, 0.002, 0.004, 0.006, 0.008,
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.0, 4.5, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0
]
[site_params]
vs30s = [1000]
location_lists = [['WLG','AKL','DUD','CHC']]
[logic_tree]
srm_logic_tree = "/home/chrisdc/NSHM/DEV/COMPONENTS/nzshm-model/SRM_LTs/python/SLT_v9p0p0.py"
slt_decomposition = "component"
# override any of the defaults runzi uses for openquake here either for iteration or just a single value
[iterate.general]
ps_grid_spacings = [15, 30]
[iterate.erf]
rupture_mesh_spacings = [2, 4]
[single.calculation]
truncation_level = 3
maximum_distance = { "Active Shallow Crust" = [[4.0, 0], [5.0, 100.0], [6.0, 200.0], [9.5, 250.0]], "Subduction Interface" = [[5.0, 0], [6.0, 200.0], [10, 600.0]], "Subduction Intraslab" = [[5.0, 0], [6.0, 200.0], [10, 700.0]] }
# alternative method, though this can be prone to error because any TRT not overwritten will get the defaults
# maximum_distance."Active Shallow Crust" = [[4.0, 0], [5.0, 100.0], [6.0, 200.0], [9.5, 250.0]]
# maximum_distance."Subduction Interface" = [[5.0, 0], [6.0, 200.0], [10, 600.0]]
# maximum_distance."Subduction Intraslab" = [[5.0, 0], [6.0, 200.0], [10, 700.0]]