This task aims to create a new script to create an emp DS IMDB using the OQ's models that are capable of vectorization to perform better.
A script called openquake_wrapper_vectorized.py is designed to work with vectorized OQ models.
The script can handle the following IMs:
- PGA
- pSA
and support the following OQ Models - Green: working fine, Orange - Need some checks
- AG_20
- AG_20_NZ
- ASK_14
- Br_10
- BSSA_14
- CB_14
- CY_14
- K_20
- K_20_NZ
- P_20
- ZA_06
Some models needed some changes to work within a script called new_calc_emp_ds.py
Ideally, we were looking for the outputs from the original script, calc_emp_ds and a new script, new_calc_emp_ds to be identical.(Or reasonably close enough with
np.isclose())
Different COEFFS tables
I wrote a script that will compare the DS IMDB between the EE version and the OQ version, and I noticed the model BSSA_14 is the model that is returning utterly different in terms of mean values.
This is because the COEFFS tables were not identical between EE and OQ.
For instance,
# EE version # -1 => PGV, 0 => PGA periods = np.array([-1, 0, 0.01, 0.02, 0.03, 0.05, 0.075, 0.1]) c3 = np.array([-0.00344, -0.00809, -0.00809, -0.00807, -0.00834, -0.00982, -0.01058, -0.01020]) # OQ version c3_2 = np.array([-0.003440, -0.008088, -0.008088, -0.008074, -0.008336, -0.009819, -0.010580, -0.010200]) (c3 == c3_2).all() # False
Based on the paper(page 93 or 118/142 in viewer), the C3 matches EE's C3, not OQ's C3.
Comparison results - between calc_emp_ds and new_calc_emp_ds
The following models do not match(used np.isclose()):
- BSSA_14 - As mentioned above, COEFFS table is not quite the same, so this is the expected result.
- This is because of
_get_basin_depth_term
. Within the OQ, with our usage, Global a.k.a nobasin in OQ term, basin_depth_term is basically 0 but within EE, we get something. - Unfortunately, paper was not really clear, it did indicate to add basin_depth_term for California and Japan, but any other region was not mentioned.
- This is because of
- CB_14 - This is also expected because in the EE version of CB_14 when they estimate width, instead of using either the provided Ztor or estimated one, they estimate Ztor again to calculate width and then set Zhyp(hypo_depth) to 9.0. In contrast, with OQ(once our changes apply), the model will not estimate Ztor again while estimating width, and we do not set Zhyp to 9.0 while calculating width.
- K_20_NZ -
This is something different. Previously(calc_emp_ds), we also used the OQ's K_20 model, so nothing to do with EE. The K_20 is fine, but K_20_NZ is different. We need some investigation into this.- The mystery is solved now, when we generated GNZL, we did not multiply by 1000 on Z1.0.
ZA_06 - This is expected because of the following behaviour:
# In the EE version of ZA_06 # convert to median in g sa = np.exp(log_sa) / 981 # In the OQ version of ZA_06 from scipy.constants import g sa = np.exp(log_sa) * 1e-2 / g # where g = 9.80665