Source code for openquake.hazardlib.gsim.zafarani_2018
# -*- 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:`ZafaraniEtAl2018` class:`ZafaraniEtAl2018VHratio`"""importnumpyasnpfromscipy.constantsimportgfromopenquake.hazardlib.gsim.baseimportGMPE,CoeffsTablefromopenquake.hazardlib.gsimimportutilsfromopenquake.hazardlibimportconstfromopenquake.hazardlib.imtimportPGA,SAdef_compute_distance(C,ctx):""" Compute the second term of the equation 1 which is presented in eq.3 and c2 is zero: ``c1 * log(sqrt(Rjb ** 2 + h ** 2)/Rref)`` """rref=1.0rval=np.sqrt(ctx.rjb**2+C['h']**2)returnC['c1']*np.log10(rval/rref)def_compute_magnitude(C,ctx):""" Compute the third term of the equation 1: e1 + b1 * (M-Mh) + b2 * (M-Mh)**2 for M<=Mh e1 + b3 * (M-Mh) otherwise """returnnp.where(ctx.mag<=C['mh'],C["e1"]+C['b1']*(ctx.mag-C['mh'])+C['b2']*(ctx.mag-C['mh'])**2,C["e1"]+C['b3']*(ctx.mag-C['mh']))def_get_mechanism(C,ctx):""" Compute the fifth term of the equation 1 described on paragraph : Get fault type dummy variables, see Table 1 """SS,U,TF=utils.get_fault_type_dummy_variables(ctx)fU=0returnC['fTF']*TF+C['fSS']*SS+fU*Udef_get_site_amplification(C,ctx):""" Compute the fourth term of the equation 1 described on paragraph : The functional form Fs in Eq. (1) represents the site amplification and it is given by FS = sj Cj , for j = 1,...,5, where sj are the coefficients to be determined through the regression analysis, while Cj are dummy variables used to denote the five different EC8 site classes """ssa,ssb,ssc,ssd=_get_site_type_dummy_variables(ctx)sA=0return(sA*ssa+C['sB']*ssb+C['sC']*ssc+C['sD']*ssd)def_get_site_type_dummy_variables(ctx):""" Get site type dummy variables, five different EC8 site classes The recording ctx are classified into 5 classes, based on the shear wave velocity intervals in the uppermost 30 m, Vs30, according to the EC8 (CEN 2003): class A: Vs30 > 800 m/s class B: Vs30 = 360 − 800 m/s class C: Vs30 = 180 - 360 m/s class D: Vs30 < 180 m/s """ssa=np.zeros(len(ctx.vs30))ssb=np.zeros(len(ctx.vs30))ssc=np.zeros(len(ctx.vs30))ssd=np.zeros(len(ctx.vs30))# Class D; Vs30 < 180 m/s.idx=(ctx.vs30>=1E-10)&(ctx.vs30<180.0)ssd[idx]=1.0# SClass C; 180 m/s <= Vs30 <= 360 m/s.idx=(ctx.vs30>=180.0)&(ctx.vs30<360.0)ssc[idx]=1.0# Class B; 360 m/s <= Vs30 <= 800 m/s.idx=(ctx.vs30>=360.0)&(ctx.vs30<800)ssb[idx]=1.0# Class A; Vs30 > 800 m/s.idx=(ctx.vs30>=800.0)ssa[idx]=1.0returnssa,ssb,ssc,ssd
[docs]classZafaraniEtAl2018(GMPE):""" Implements GMPE developed by H.Zafarani, L.Luzi, G.Lanzano, M.R.Soghrat and published as "Empirical equations for the prediction of PGA and pseudo spectral accelerations using Iranian strong-motion data", J Seismol, DOI 10.1007/s10950-017-9704-y. SA are given from 0.04 s to 4 s. The regressions are developed considering the geometrical mean of the horizontal components """#: Supported tectonic region type is 'active shallow crust' because the#: equations have been derived from data from Iran database, as#: explained in the 'Introduction'.DEFINED_FOR_TECTONIC_REGION_TYPE=const.TRT.ACTIVE_SHALLOW_CRUST#: Supported intensity measure types are PGA and SADEFINED_FOR_INTENSITY_MEASURE_TYPES={PGA,SA}#: Supported intensity measure component is the geometric mean of two#: horizontal componentsDEFINED_FOR_INTENSITY_MEASURE_COMPONENT=const.IMC.GEOMETRIC_MEAN#: Supported standard deviation types are inter-event, intra-event#: and total, page 1904DEFINED_FOR_STANDARD_DEVIATION_TYPES={const.StdDev.TOTAL,const.StdDev.INTER_EVENT,const.StdDev.INTRA_EVENT}#: Required site parameter is only Vs30REQUIRES_SITES_PARAMETERS={'vs30'}#: Required rupture parameters are magnitude and rake (eq. 1).REQUIRES_RUPTURE_PARAMETERS={'rake','mag'}#: Required distance measure is Rjb (eq. 1).REQUIRES_DISTANCES={'rjb'}
[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]imean=(_compute_magnitude(C,ctx)+_compute_distance(C,ctx)+_get_site_amplification(C,ctx)+_get_mechanism(C,ctx))mean[m]=np.log((10.0**(imean-2.0))/g)# Return stddevs in terms of natural log scalingsig[m]=np.log(10.0**C['SigmaTot'])tau[m]=np.log(10.0**C['SigmaB'])phi[m]=np.log(10.0**C['SigmaW'])
[docs]classZafaraniEtAl2018VHratio(ZafaraniEtAl2018):""" Calculates the V/H ratio. """DEFINED_FOR_INTENSITY_MEASURE_COMPONENT=const.IMC.VERTICAL_TO_HORIZONTAL_RATIO
[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]imean=(_compute_magnitude(C,ctx)+_compute_distance(C,ctx)+_get_site_amplification(C,ctx)+_get_mechanism(C,ctx))mean[m]=np.log(10.0**imean)# Return stddevs in terms of natural log scalingsig[m]=np.log(10.0**C['SigmaTot'])tau[m]=np.log(10.0**C['SigmaB'])phi[m]=np.log(10.0**C['SigmaW'])