Source code for openquake.hazardlib.gsim.toro_1997
# -*- 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:`ToroEtAl1997MblgNSHMP2008`,:class:`ToroEtAl1997MwNSHMP2008`"""importnumpyasnpfromopenquake.hazardlib.gsim.baseimportCoeffsTable,GMPEfromopenquake.hazardlib.gsim.utilsimport(mblg_to_mw_johnston_96,mblg_to_mw_atkinson_boore_87,clip_mean)fromopenquake.hazardlibimportconstfromopenquake.hazardlib.imtimportPGA,SAfromopenquake.baselib.generalimportCallableDict_compute_finite_fault_correction=CallableDict()@_compute_finite_fault_correction.add("Mblg")def_compute_finite_fault_correction_Mblg(kind,mag):""" Compute finite fault correction term as geometric mean of correction terms obtained from Mw values calculated with Johnston 1996 and Atkinson and Boore 1987 conversion equations. Implement equations as in lines 1653 - 1658 in hazgridXnga2.f """mw_j96=mblg_to_mw_johnston_96(mag)mw_ab87=mblg_to_mw_atkinson_boore_87(mag)t1=np.exp(-1.25+0.227*mw_j96)t2=np.exp(-1.25+0.227*mw_ab87)returnnp.sqrt(t1*t2)@_compute_finite_fault_correction.add("Mw")def_compute_finite_fault_correction_Mw(kind,mag):""" Compute finite fault correction term. """returnnp.exp(-1.25+0.227*mag)def_compute_mean(kind,C,mag,rjb):""" Compute ground motion mean value. """# line 1686 in hazgridXnga2.fffc=_compute_finite_fault_correction(kind,mag)d=np.sqrt(rjb**2+(C['c7']**2)*(ffc**2))# lines 1663, 1694-1696 in hazgridXnga2.fmean=(C['c1']+C['c2']*(mag-6.)+C['c3']*((mag-6.)**2)-C['c4']*np.log(d)-C['c6']*d)factor=np.log(rjb/100.)idx=factor>0mean[idx]-=(C['c5']-C['c4'])*factor[idx]returnmean
[docs]classToroEtAl1997MblgNSHMP2008(GMPE):""" Implements GMPE developed by G. R. Toro, N. A. Abrahamson, J. F. Schneider and published in "Model of Strong Ground Motions from Earthquakes in Central and Eastern North America: Best Estimates and Uncertainties" (Seismological Research Letters, Volume 68, Number 1, 1997) as utilized by the National Seismic Hazard Mapping Project (NSHMP) for the 2008 US hazard model. This class replicates the algorithm for the Toro et. al. 1997 GMPE as coded in the subroutine ``getToro`` in the ``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 (given that MFDs for central and eastern US are given in this scale). The equation implements also the finite-fault correction as given in "Modification of the Toro et al. 1997 Attenuation Equations for Large Magnitudes and Short Distances" (available at: http://www.riskeng.com/downloads/attenuation_equations). The correction uses Mw. Therefore Mblg is converted to Mw using both the Atkinson & Boore 1987 and Johnston 1996 conversion equations and an average correction term is computed. Coefficients are given for the B/C site conditions. """kind="Mblg"#: Supported tectonic region type is stable continental crust,#: given that the equations have been derived for central and eastern#: north AmericaDEFINED_FOR_TECTONIC_REGION_TYPE=const.TRT.STABLE_CONTINENTAL#: Supported intensity measure types are spectral acceleration,#: and peak ground accelerationDEFINED_FOR_INTENSITY_MEASURE_TYPES={PGA,SA}#: Supported intensity measure component is the geometric mean of#: two horizontal components#: :attr:`~openquake.hazardlib.const.IMC.GEOMETRIC_MEAN`,DEFINED_FOR_INTENSITY_MEASURE_COMPONENT=const.IMC.GEOMETRIC_MEAN#: Supported standard deviation type is only total.DEFINED_FOR_STANDARD_DEVIATION_TYPES={const.StdDev.TOTAL}#: No site parameters requiredREQUIRES_SITES_PARAMETERS=set()#: Required rupture parameter is only magnitude (Mblg).REQUIRES_RUPTURE_PARAMETERS={'mag'}#: Required distance measure is rjbREQUIRES_DISTANCES={'rjb'}#: Shear-wave velocity for reference soil conditions in [m s-1]DEFINED_FOR_REFERENCE_VELOCITY=760.
[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]mean[m]=clip_mean(imt,_compute_mean(self.kind,C,ctx.mag,ctx.rjb))sig[m]=C['sigma']