Source code for openquake.hazardlib.gsim.tavakoli_pezeshk_2005
# -*- coding: utf-8 -*-# vim: tabstop=4 shiftwidth=4 softtabstop=4## Copyright (C) 2014-2025 GEM Foundation## OpenQuake is free software: you can redistribute it and/or modify it# under the terms of the GNU Affero General Public License as published# by the Free Software Foundation, either version 3 of the License, or# (at your option) any later version.## OpenQuake is distributed in the hope that it will be useful,# but WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# GNU Affero General Public License for more details.## You should have received a copy of the GNU Affero General Public License# along with OpenQuake. If not, see <http://www.gnu.org/licenses/>."""Module exports :class:`TavakoliPezeshk2005`,:class:`TavakoliPezeshk2005MblgAB1987NSHMP2008`,:class:`TavakoliPezeshk2005MblgJ1996NSHMP2008`,:class:`TavakoliPezeshk2005MwNSHMP2008`"""importnumpyasnpfromopenquake.hazardlib.gsim.baseimportGMPE,CoeffsTablefromopenquake.hazardlibimportconstfromopenquake.hazardlib.imtimportPGA,SAfromopenquake.hazardlib.gsim.utilsimport(mblg_to_mw_atkinson_boore_87,mblg_to_mw_johnston_96,clip_mean)def_compute_anelastic_attenuation_term(C,rrup,mag):""" Compute magnitude-distance scaling term as defined in equation 21, page 2291 (Tavakoli and Pezeshk, 2005) """r=(rrup**2.+(C['c5']*np.exp(C['c6']*mag+C['c7']*(8.5-mag)**2.5))**2.)**.5f3=((C['c4']+C['c13']*mag)*np.log(r)+(C['c8']+C['c12']*mag)*r)returnf3def_compute_geometrical_spreading_term(C,rrup):""" Compute magnitude scaling term as defined in equation 19, page 2291 (Tavakoli and Pezeshk, 2005) """f2=np.ones_like(rrup)idx1=np.nonzero(rrup<=70.)idx2=np.nonzero((rrup>70.)&(rrup<=130.))idx3=np.nonzero(rrup>130.)f2[idx1]=(C['c9']*np.log(rrup[idx1]+4.5))f2[idx2]=(C['c10']*np.log(rrup[idx2]/70.)+C['c9']*np.log(rrup[idx2]+4.5))f2[idx3]=(C['c11']*np.log(rrup[idx3]/130.)+C['c10']*np.log(rrup[idx3]/70.)+C['c9']*np.log(rrup[idx3]+4.5))returnf2def_compute_magnitude_scaling_term(C,mag):""" Compute magnitude scaling term as defined in equation 19, page 2291 (Tavakoli and Pezeshk, 2005) """if(mag>8.5).any():raiseValueError('Magnitude %s > 8.5'%mag)returnC['c1']+C['c2']*mag+C['c3']*(8.5-mag)**2.5
[docs]classTavakoliPezeshk2005(GMPE):""" Implements the GMPE developed by B. Tavakoli and S. Pezeshk in 2005 and published as "Empirical-Stochastic Ground-Motion Prediction for Eastern North America" (2005, Bull. Seism. Soc. Am., Volume 95, No. 6, pages 2283-2296). """#: Supported tectonic region type is stable continental crustDEFINED_FOR_TECTONIC_REGION_TYPE=const.TRT.STABLE_CONTINENTAL#: Supported intensity measure types are peak ground acceleration#: and spectral acceleration, see abstractDEFINED_FOR_INTENSITY_MEASURE_TYPES={PGA,SA}#: Supported intensity measure horizontal.DEFINED_FOR_INTENSITY_MEASURE_COMPONENT=const.IMC.HORIZONTAL#: Supported standard deviation type is total, see equation 23, pag 2291.DEFINED_FOR_STANDARD_DEVIATION_TYPES={const.StdDev.TOTAL}#: This GMPE doesn't require site parameters since it has been developed#: for hard rock ctx (see page 2290)REQUIRES_SITES_PARAMETERS=set()#: Required rupture parameters is magnitude#: See equation 18 page page 2291REQUIRES_RUPTURE_PARAMETERS={'mag'}#: Required distance measure is Rrup.#: See equation 18 page page 2291REQUIRES_DISTANCES={'rrup'}kind='base'
[docs]defcompute(self,ctx:np.recarray,imts,mean,sig,tau,phi):""" See :meth:`superclass method <.base.GroundShakingIntensityModel.compute>` for spec of input and result values. """form,imtinenumerate(imts):C=self.COEFFS[imt]ifself.kind=='Mblg':mag=mblg_to_mw_johnston_96(ctx.mag)elifself.kind=='Mblg2008':mag=mblg_to_mw_atkinson_boore_87(ctx.mag)else:mag=ctx.mag# computing the magnitude term. Equation 19, page 2291f1=_compute_magnitude_scaling_term(C,mag)# computing the geometrical spreading term. Equation 20, page 2291f2=_compute_geometrical_spreading_term(C,ctx.rrup)# computing the anelastic attenuation term. Equation 21, page 2291f3=_compute_anelastic_attenuation_term(C,ctx.rrup,mag)# computing the mean ln(IMT) using equation 18 at page 2290mean[m]=f1+f2+f3ifself.kind!='base':# in subclassesmean[m]=clip_mean(imt,mean[m])# computing the total standard deviationsig[m]=np.where(mag<7.2,C['c14']+C['c15']*mag,C['c16'])
[docs]classTavakoliPezeshk2005MblgAB1987NSHMP2008(TavakoliPezeshk2005):""" Extend :class:`TavakoliPezeshk2005` and implements equation as defined by the National Seismic Hazard Mapping Project (NSHMP) for the 2008 US model. The class replicates the equation as coded in suroutine ``getTP05`` in ``hazgridXnga2.f`` Fortran code available at: http://earthquake.usgs.gov/hazards/products/conterminous/2008/software/ The class assumes rupture magnitude to be in Mblg scale. Therefore Mblg is converted to Mw using the Atkinson & Boore 1987 conversion equation. Coefficients are given for the B/C site conditions. """kind='Mblg2008'#: Shear-wave velocity for reference soil conditions in [m s-1]DEFINED_FOR_REFERENCE_VELOCITY=760.#: Coefficient table is constructed using the values included in#: hazgridXnga2.fCOEFFS=CoeffsTable(sa_damping=5,table="""\ IMT c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 pga 1.56E+00 6.23E-01 -4.83E-02 -1.81E+00 -6.52E-01 4.46E-01 -2.93E-05 -4.05E-03 9.46E-03 1.41E+00 -9.61E-01 4.32E-04 1.33E-04 1.21E+00 -1.11E-01 4.09E-01 5.00E-02 2.24E+00 5.33E-01 -4.75E-02 -1.63E+00 -5.67E-01 4.54E-01 7.77E-03 -4.91E-03 -3.14E-03 9.80E-01 -9.39E-01 5.12E-04 9.30E-04 1.22E+00 -1.08E-01 4.41E-01 8.00E-02 1.10E+00 7.43E-01 -2.93E-02 -1.71E+00 -7.56E-01 4.60E-01 -9.68E-04 -4.94E-03 -5.50E-03 1.13E+00 -9.16E-01 4.82E-04 7.33E-04 1.22E+00 -1.08E-01 4.49E-01 1.00E-01 1.4229 6.07E-01 -4.74E-02 -1.52E+00 -7.04E-01 4.49E-01 -6.19E-03 -4.70E-03 -4.24E-03 1.04E+00 -9.13E-01 4.11E-04 3.58E-04 1.23E+00 -1.08E-01 4.56E-01 1.50E-01 2.87E+00 5.01E-01 -6.42E-02 -1.73E+00 -9.76E-01 4.14E-01 6.60E-03 -4.80E-03 3.93E-03 1.51E+00 -8.65E-01 3.64E-04 6.84E-04 1.24E+00 -1.08E-01 4.64E-01 2.00E-01 1.70E-02 8.57E-01 -2.62E-02 -1.68E+00 -8.61E-01 4.33E-01 2.79E-03 -3.65E-03 -2.02E-03 1.64E+00 -9.25E-01 1.61E-04 6.43E-04 1.24E+00 -1.08E-01 4.69E-01 3.00E-01 0.491 6.67E-01 -4.43E-02 -1.42E+00 -4.70E-01 4.68E-01 1.08E-02 -5.41E-03 6.44E-03 1.52E+00 -9.15E-01 4.32E-04 2.87E-04 1.26E+00 -1.09E-01 4.79E-01 5.00E-01 6.97E-01 6.11E-01 -7.89E-02 -1.55E+00 -8.44E-01 4.14E-01 7.89E-03 -3.65E-03 -2.65E-04 1.59E+00 -8.59E-01 2.77E-04 1.46E-04 1.28E+00 -1.07E-01 5.05E-01 7.50E-01 -3.23E-01 6.66E-01 -8.30E-02 -1.48E+00 -7.34E-01 4.35E-01 9.53E-03 -3.37E-03 -1.19E-03 1.55E+00 -7.84E-01 2.45E-04 5.47E-04 1.28E+00 -1.05E-01 5.22E-01 1.00E+00 -1.26E+00 7.64E-01 -8.59E-02 -1.49E+00 -9.41E-01 4.24E-01 -5.84E-03 -2.09E-03 3.30E-03 1.52E+00 -7.57E-01 1.17E-04 7.59E-04 1.28E+00 -1.03E-01 5.37E-01 1.50E+00 -1.94E+00 7.94E-01 -8.84E-02 -1.45E+00 -8.86E-01 4.12E-01 8.30E-03 -3.27E-03 2.51E-03 1.71E+00 -7.69E-01 2.33E-04 1.66E-04 1.27E+00 -9.99E-02 5.51E-01 2.00E+00 -2.5177 8.05E-01 -9.29E-02 -1.44E+00 -9.23E-01 4.08E-01 2.06E-02 -2.14E-03 2.30E-03 1.43E+00 -7.55E-01 2.14E-04 3.91E-04 1.26E+00 -9.78E-02 5.62E-01 3.00E+00 -2.28 8.01E-01 -1.08E-01 -1.65E+00 -8.98E-01 4.37E-01 1.67E-02 -2.03E-03 3.58E-03 1.93E+00 -8.18E-01 1.16E-04 3.98E-04 1.26E+00 -9.52E-02 5.73E-01 4.00E+00 -2.28 8.17E-01 -1.18E-01 -1.46E+00 -8.45E-01 4.25E-01 1.13E-02 -1.72E-03 -3.34E-03 1.69E+00 -7.37E-01 1.10E-04 3.59E-04 1.25E+00 -9.26E-02 5.89E-01 """)
[docs]classTavakoliPezeshk2005MblgJ1996NSHMP2008(TavakoliPezeshk2005MblgAB1987NSHMP2008):""" Extend :class:`TavakoliPezeshk2005MblgAB1987NSHMP2008` but uses Johnston 1996 equation to convert Mblg to Mw """kind='Mblg'
[docs]classTavakoliPezeshk2005MwNSHMP2008(TavakoliPezeshk2005MblgAB1987NSHMP2008):""" Extend :class:`TavakoliPezeshk2005MblgAB1987NSHMP2008` but assumes magnitude to be in Mw scale, and therefore no conversion is applied """kind='2008'