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())


1. ASK_14 - Need to check

ASK_14 model requires us to provide a width parameter, and we do not have width information.

However, we managed to find an equation that estimates a width for us, which is from NGA-West 2 spreadsheet.

This equation is not included in the ASK_14 paper, so we cannot justify proposing these changes to OpenQuake, but we can use this within our OQ wrapper to estimate a width.

2.  CB_14 - Need to check

CB_14 model also requires us to provide width, but unlike ASK_14, the CB_14  paper includes how to estimate the width.

On top of the width estimation, I also implemented an estimation of Ztor and Hypo Depth in the paper.


Hence, I opened a PR for Ztor estimation on OQ first, but we do not know what will happen. Therefore, the alternative way of using these estimations is to implement these within our wrapper along with ASK_14's width estimation.

3. CY_14

There was a missing piece within this model, and it is now fixed.

4. K_20 and K_20_NZ

Kuehn's model makes some adjustments to the magnitude breakpoint, and this should only happen if the tectonic type is SUBDUCTION_INTERFACE and the region is either Japan or South America. However, the previous version of the K_20 applied this adjustment to every region if the tectonic type is SUBDUCTION_INTERFACE. More details can be found here.

5. ZA_06

ZA_06 officially supports periods between 0.05 and 5.0, but we'd like to compute between 0.01 and 10.0.

Hence, we had to implement both interpolation and extrapolation. Unfortunately, we couldn't have the way OQ's interpolation. (It will include log(0), which is not valid.). Hence, we keep the interpolation and extrapolation from EE.


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.
  • 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







  • No labels