Source code for openquake.hazardlib.gsim.lanzano_2016
# -*- 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:`LanzanoEtAl2016`."""importnumpyasnpfromscipy.constantsimportgfromopenquake.hazardlib.gsim.baseimportGMPE,CoeffsTablefromopenquake.hazardlib.gsimimportutilsfromopenquake.hazardlibimportconstfromopenquake.hazardlib.imtimportPGA,PGV,SAfromopenquake.baselib.generalimportCallableDict_compute_distance=CallableDict()@_compute_distance.add('rjb')def_compute_distance_rjb(dist_type,ctx,C):""" Compute the third term of the equation 1: FD(Mw,R) = [c1j + c2j(M-Mr)] * log10(R/Rh) con j=1,...4 (eq 4) c coeffs are in matrix C """Mr=5.0Rh=70LATref=-0.33*ctx.lon+48.3diff=ctx.lat-LATrefR=np.sqrt(ctx.rjb**2+C['h']**2)dist_term=(diff>=0)*(C['c11']+C['c21']*(ctx.mag-Mr))*\
(R<=Rh)*np.log10(R/Rh)+\
(diff>=0)*(C['c12']+C['c22']*(ctx.mag-Mr))*\
(R>Rh)*np.log10(R/Rh)+\
(diff<0)*(C['c13']+C['c23']*(ctx.mag-Mr))*\
(R<=Rh)*np.log10(R/Rh)+\
(diff<0)*(C['c14']+C['c24']*(ctx.mag-Mr))*\
(R>Rh)*np.log10(R/Rh)returndist_term@_compute_distance.add('rhypo')def_compute_distance_rhypo(dist_type,ctx,C):""" Compute the third term of the equation 1: FD(Mw,R) = [c1j + c2j(M-Mr)] * log10(R/Rh) con j=1,...4 (eq 4) c coeffs are in matrix C """Mr=5.0Rh=70LATref=-0.33*ctx.lon+48.3diff=ctx.lat-LATrefR=ctx.rhypodist_term=(diff>=0)*(C['c11']+C['c21']*(ctx.mag-Mr))*\
(R<=Rh)*np.log10(R/Rh)+\
(diff>=0)*(C['c12']+C['c22']*(ctx.mag-Mr))*\
(R>Rh)*np.log10(R/Rh)+\
(diff<0)*(C['c13']+C['c23']*(ctx.mag-Mr))*\
(R<=Rh)*np.log10(R/Rh)+\
(diff<0)*(C['c14']+C['c24']*(ctx.mag-Mr))*\
(R>Rh)*np.log10(R/Rh)returndist_termdef_compute_magnitude(ctx,C):""" Compute the second term of the equation 1: Fm(M) = b1(M-Mr) + b2(M-Mr)^2 Eq (5) """Mr=5returnC['a']+C['b1']*(ctx.mag-Mr)+C['b2']*(ctx.mag-Mr)**2def_get_basin_effect_term(ctx,C):""" Get basin correction for ctx in the Po Plain. if ctx.bas == 0 the correction is not necessary, otherwise if ctx.bas == 1 the site is in the Po Plain and the correction is applied. """delta=np.zeros(len(ctx.vs30))delta[ctx.bas==1]=1.0returnC['dbas']*deltadef_get_mechanism(ctx,C):""" Compute the part of the second term of the equation 1 (FM(SoF)): Get fault type dummy variables """UN,NF,TF=utils.get_fault_type_dummy_variables(ctx)returnC['fNF']*NF+C['fTF']*TF+C['fUN']*UNdef_get_site_amplification(ctx,C):""" 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,...,3, 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=_get_site_type_dummy_variables(ctx)return(C['sA']*ssa)+(C['sB']*ssb)+(C['sC']*ssc)def_get_site_type_dummy_variables(ctx):""" Get site type dummy variables, five different EC8 site classes The recording ctx are classified into 3 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 < 360 m/s """ssa=np.zeros(len(ctx.vs30))ssb=np.zeros(len(ctx.vs30))ssc=np.zeros(len(ctx.vs30))# Class C; 180 m/s <= Vs30 <= 360 m/s.idx=ctx.vs30<360.0ssc[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
[docs]classLanzanoEtAl2016_RJB(GMPE):""" Implements GMPE developed by G.Lanzano, M. D'Amico, C.Felicetta, R.Puglia, L.Luzi, F.Pacor, D.Bindi and published as "Ground-Motion Prediction Equations for Region-Specific Probabilistic Seismic-Hazard Analysis", Bull Seismol. Soc. Am., DOI 10.1785/0120150096 SA are given up to 4 s. The regressions are developed considering the geometrical mean of the as-recorded horizontal components """#: Supported tectonic region type is 'active shallow crust' because the#: equations have been derived from data from Italian database ITACA, as#: explained in the 'Introduction'.DEFINED_FOR_TECTONIC_REGION_TYPE=const.TRT.ACTIVE_SHALLOW_CRUST#: Set of :mod:`intensity measure types <openquake.hazardlib.imt>`#: this GSIM can calculate. A set should contain classes from module#: :mod:`openquake.hazardlib.imt`.DEFINED_FOR_INTENSITY_MEASURE_TYPES={PGA,PGV,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 totalDEFINED_FOR_STANDARD_DEVIATION_TYPES={const.StdDev.TOTAL,const.StdDev.INTER_EVENT,const.StdDev.INTRA_EVENT}#: Required site parameterREQUIRES_SITES_PARAMETERS={'vs30','lon','lat','bas'}#: Required rupture parameters are magnitude and rake (eq. 1).REQUIRES_RUPTURE_PARAMETERS={'rake','mag'}#: Required distance measure is R Joyner-Boore distance (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]dist_type='rjb'if"RJB"inself.__class__.__name__else'rhypo'imean=(_compute_magnitude(ctx,C)+_compute_distance(dist_type,ctx,C)+_get_site_amplification(ctx,C)+_get_basin_effect_term(ctx,C)+_get_mechanism(ctx,C))# Convert units to g, but only for PGA and SA (not PGV):ifimt.string.startswith(("SA","PGA")):mean[m]=np.log((10.0**(imean-2.0))/g)else:# PGVmean[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['tau'])phi[m]=np.log(10.0**C['phi'])