Source code for openquake.hazardlib.gsim.lanzano_luzi_2019
# -*- coding: utf-8 -*-# vim: tabstop=4 shiftwidth=4 softtabstop=4## Copyright (C) 2015-2023 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:`LanzanoLuzi2019shallow`, :class:`LanzanoLuzi2019deep`"""importnumpyasnpfromscipy.constantsimportgfromopenquake.hazardlib.gsim.baseimportGMPE,CoeffsTablefromopenquake.hazardlibimportconstfromopenquake.hazardlib.imtimportPGA,PGV,SAdef_compute_distance(rval2,C,kind):""" Compute the distance function """ifkind=='shallow':# equation (9)h1=2rval=np.sqrt(rval2**2+h1**2)returnC['c1']*np.log10(rval)elifkind=='deep':# equation (5)h2=5rval=np.sqrt(rval2**2+h2**2)returnC['c2']*np.log10(rval)+C['c3']*rvalraiseValueError(kind)def_compute_magnitude(ctx,C):""" Compute the magnitude function, equation (9): """returnC['a']+C['b']*ctx.magdef_get_site_amplification(ctx,C):""" Compute the site amplification function given by FS = eiSi, for i = 1,2,3 where Si are the coefficients determined through regression analysis, and ei are dummy variables (0 or 1) used to denote the different EC8 site classes. """ssb,ssc=_get_site_type_dummy_variables(ctx)return(C['sB']*ssb)+(C['sC']*ssc)def_get_site_type_dummy_variables(ctx):""" Get site type dummy variables, which classified the ctx into different site classes based on the shear wave velocity in the upper 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 """ssb=np.zeros(len(ctx.vs30))ssc=np.zeros(len(ctx.vs30))# Class C; Vs30 < 360 m/s.idx=(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.0)ssb[idx]=1.0returnssb,ssc
[docs]classLanzanoLuzi2019shallow(GMPE):""" Implements GMPE developed by Giovanni Lanzano and Lucia Luzi (2019) and submitted as "A ground motion model for volcanic areas in Italy" Bulletin of Earthquake Engineering. GMPE derives from earthquakes in the volcanic areas in Italy in the magnitude range 3<ML<5 for hypocentral distances <200 km, and for rock (EC8-A), stiff soil (EC8-B) and soft soil (EC8-C and EC8-D). The GMPE distinguishes between shallow volcano-tectonic events related to flank movements (focal depths <5km) and deeper events occurring due to regional tectonics (focal depths >5km), considering two different attenuations with distances. Test tables are generated from a spreadsheet provided by the authors, and modified according to OQ format (e.g. conversion from cm/s2 to m/s2). """kind='shallow'#: Supported tectonic region type is 'volcanic'DEFINED_FOR_TECTONIC_REGION_TYPE=const.TRT.VOLCANIC#: Supported intensity measure types are PGA and SADEFINED_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 total, page 1904DEFINED_FOR_STANDARD_DEVIATION_TYPES={const.StdDev.TOTAL,const.StdDev.INTER_EVENT,const.StdDev.INTRA_EVENT}#: Required site parameter is Vs30REQUIRES_SITES_PARAMETERS={'vs30'}#: Required rupture parameter is magnitude.REQUIRES_RUPTURE_PARAMETERS={'mag'}#: Required distance measure is Rhypo.REQUIRES_DISTANCES={'rhypo'}
[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(ctx,C)+_compute_distance(ctx.rhypo,C,self.kind)+_get_site_amplification(ctx,C))istddevs=[C['sigma'],C['tau'],C['phi']]# 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:# PGV:mean[m]=np.log(10.0**imean)# Return stddevs in terms of natural log scalingsig[m],tau[m],phi[m]=np.log(10.0**np.array(istddevs))