Source code for openquake.hazardlib.gsim.atkinson_boore_2003
# -*- coding: utf-8 -*-# vim: tabstop=4 shiftwidth=4 softtabstop=4## Copyright (C) 2012-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:`AtkinsonBoore2003SInter`,:class:`AtkinsonBoore2003SSlab`,:class:`AtkinsonBoore2003SInterNSHMP2008`,:class:`AtkinsonBoore2003SSlabNSHMP2008`,:class:`AtkinsonBoore2003SSlabCascadia`,:class:`AtkinsonBoore2003SSlabCascadiaNSHMP2008`,:class:`AtkinsonBoore2003SSlabJapan`:class:`AtkinsonBoore2003SSlabJapanNSHMP2008`"""importnumpyasnpfromscipy.constantsimportgimportcopyfromopenquake.hazardlib.gsim.baseimportGMPE,CoeffsTablefromopenquake.hazardlibimportconstfromopenquake.hazardlib.imtimportPGA,SAfromopenquake.baselib.generalimportCallableDictdef_compute_mean(kind,C,g,mag,hypo_depth,rrup,vs30,pga_rock,imt):""" Compute mean according to equation 1, page 1706. """hypo_depth=np.clip(hypo_depth,0,100.)delta=0.00724*10**(0.507*mag)R=np.sqrt(rrup**2+delta**2)s_amp=_compute_soil_amplification(kind,C,vs30,pga_rock,imt)mean=(# 1st termC['c1']+C['c2']*mag+# 2nd termC['c3']*hypo_depth+# 3rd termC['c4']*R-# 4th termg*np.log10(R)+# 5th, 6th and 7th termss_amp)returnmean_compute_site_class_dummy_variables=CallableDict()@_compute_site_class_dummy_variables.add('SInter')def_compute_site_class_dummy_variables_SInter(kind,vs30):""" Compute site class dummy variables as explained in paragraph 'Functional Form', page 1706. """Sc=np.zeros_like(vs30)Sd=np.zeros_like(vs30)Se=np.zeros_like(vs30)Sc[(vs30>360)&(vs30<=760)]=1Sd[(vs30>=180)&(vs30<=360)]=1Se[vs30<180]=1returnSc,Sd,Se@_compute_site_class_dummy_variables.add('SInter2008','SSlab2008')def_compute_site_class_dummy_variables_2008(kind,vs30):""" Extend :meth:`AtkinsonBoore2003SInter._compute_site_class_dummy_variables` and includes dummy variable for B/C site conditions (vs30 > 760.) """Sbc=np.zeros_like(vs30)Sc=np.zeros_like(vs30)Sd=np.zeros_like(vs30)Se=np.zeros_like(vs30)Sbc[vs30>760.]=1Sc[(vs30>360)&(vs30<=760)]=1Sd[(vs30>=180)&(vs30<=360)]=1Se[vs30<180]=1returnSbc,Sc,Sd,Se_compute_soil_amplification=CallableDict()@_compute_soil_amplification.add('SInter')def_compute_soil_amplification_SInter(kind,C,vs30,pga_rock,imt):""" Compute soil amplification (5th, 6th, and 7th terms in equation 1, page 1706). """Sc,Sd,Se=_compute_site_class_dummy_variables(kind,vs30)sl=_compute_soil_linear_factor(pga_rock,imt)returnC['c5']*sl*Sc+C['c6']*sl*Sd+C['c7']*sl*Se@_compute_soil_amplification.add('SInter2008','SSlab2008')def_compute_soil_amplification_2008(kind,C,vs30,pga_rock,imt):""" Compute soil amplification (5th, 6th, and 7th terms in equation 1, page 1706) and add the B/C site condition as implemented by NSHMP. """Sbc,Sc,Sd,Se=_compute_site_class_dummy_variables(kind,vs30)sl=_compute_soil_linear_factor(pga_rock,imt)return(C['c5']*sl*Sbc*0.5+C['c5']*sl*Sc+C['c6']*sl*Sd+C['c7']*sl*Se)def_compute_soil_linear_factor(pga_rock,imt):""" Compute soil linear factor as explained in paragraph 'Functional Form', page 1706. """ifimt.period>=1:returnnp.ones_like(pga_rock)else:sl=np.zeros_like(pga_rock)pga_between_100_500=(pga_rock>100)&(pga_rock<500)pga_greater_equal_500=pga_rock>=500is_SA_between_05_1=0.5<imt.period<1is_SA_less_equal_05=imt.period<=0.5ifis_SA_between_05_1:sl[pga_between_100_500]=(1-(1./imt.period-1)*(pga_rock[pga_between_100_500]-100)/400)sl[pga_greater_equal_500]=1-(1./imt.period-1)ifis_SA_less_equal_05orimt.period==0:sl[pga_between_100_500]=(1-(pga_rock[pga_between_100_500]-100)/400)sl[pga_rock<=100]=1returnsl
[docs]classAtkinsonBoore2003SInter(GMPE):""" Implements GMPE developed by G. M Atkinson and D. Boore and published as "Empirical Ground-Motion Relations for Subduction-Zone Earthquakes and Their Application to Cascadia and Other Regions" (Bulletin of the Seismological Society of America, Volume 93, Number 4, pages 1703-1929, 2003) and includes correction for subduction interface equations as described in "Erratum to 'Empirical Ground Motion Relations for Subduction-Zone Earthquakes and their application to Cascadia and other regions'", Gail M. Atkinson and David M. Boore, Volume 98, Number 5, pp.2567-2569, 2008. The class implements the global model but not the corrections for Japan/Cascadia. SA values at 4 s (not supported by the original equations) are obtained from mean value at 3 s divided by a factor equal to 0.550 (scaling factor computed in the context of the SHARE project and obtained as average ratio between median values at 4 and 3 seconds as predicted by SHARE subduction GMPEs). The class implements the equations for 'Subduction Interface' (that's why the class name ends with 'SInter'). """#: Supported tectonic region type is subduction interfaceDEFINED_FOR_TECTONIC_REGION_TYPE=const.TRT.SUBDUCTION_INTERFACE#: Supported intensity measure types are spectral acceleration,#: and peak ground acceleration, see table 1, page 1715DEFINED_FOR_INTENSITY_MEASURE_TYPES={PGA,SA}#: Supported intensity measure component is the random horizontal#: component:#: attr:`~openquake.hazardlib.const.IMC.RANDOM_HORIZONTAL`, see#: paragraph 'Functional : Form', page 1706DEFINED_FOR_INTENSITY_MEASURE_COMPONENT=const.IMC.RANDOM_HORIZONTAL#: Supported standard deviation types are inter-event, intra-event#: and total, see table 1, page 1715DEFINED_FOR_STANDARD_DEVIATION_TYPES={const.StdDev.TOTAL,const.StdDev.INTER_EVENT,const.StdDev.INTRA_EVENT}DEFINED_FOR_REFERENCE_VELOCITY=800#: Required site parameters is Vs30, used to distinguish between NEHRP#: soil classes, see paragraph 'Functional Form', page 1706REQUIRES_SITES_PARAMETERS={'vs30'}#: Required rupture parameters are magnitude and focal depth, see equation#: 1, page 1706REQUIRES_RUPTURE_PARAMETERS={'mag','hypo_depth'}#: Required distance measure is closest distance to rupture, see equation#: 1, page 1706REQUIRES_DISTANCES={'rrup'}kind='SInter'
[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. """# cap magnitude values at 8.5, see page 1709mag=np.clip(ctx.mag,0,8.5)ifself.kind=='SInter2008':ctx=copy.copy(ctx)ctx.hypo_depth=20.# compute PGA on rock (needed for site amplification calculation)G=10**(1.2-0.18*mag)pga_rock=_compute_mean(self.kind,self.COEFFS_SINTER[PGA()],G,mag,ctx.hypo_depth,ctx.rrup,ctx.vs30,# by passing pga_rock > 500 the soil# amplification is 0np.zeros_like(ctx.vs30)+600,PGA())pga_rock=10**pga_rockform,imtinenumerate(imts):C=self.COEFFS_SINTER[imt]# periods 0.4 s (2.5 Hz) and 0.2 s (5 Hz) need a special case# because of the erratum. SA for 0.4s and 0.2s is computed and a# weighted sum is returnedifimt.periodin(0.2,0.4):C04=self.COEFFS_SINTER[SA(period=0.4,damping=5.0)]C02=self.COEFFS_SINTER[SA(period=0.2,damping=5.0)]mean04=_compute_mean(self.kind,C04,G,mag,ctx.hypo_depth,ctx.rrup,ctx.vs30,pga_rock,imt)mean02=_compute_mean(self.kind,C02,G,mag,ctx.hypo_depth,ctx.rrup,ctx.vs30,pga_rock,imt)ifimt.period==0.2:mean[m]=0.333*mean02+0.667*mean04else:mean[m]=0.333*mean04+0.667*mean02else:mean[m]=_compute_mean(self.kind,C,G,mag,ctx.hypo_depth,ctx.rrup,ctx.vs30,pga_rock,imt)# convert from log10 to ln and units from cm/s**2 to gmean[m]=np.log((10**mean[m])*1e-2/g)ifimt.period==4.0:mean[m]/=0.550sig[m]=np.log(10**C['sigma'])if's2'inC.dtype.names:# in the Gupta subclasstau[m]=np.log(10**C['s2'])phi[m]=np.log(10**C['s1'])
[docs]classAtkinsonBoore2003SSlab(AtkinsonBoore2003SInter):""" Implements GMPE developed by G. M Atkinson and D. Boore and published as "Empirical Ground-Motion Relations for Subduction-Zone Earthquakes and Their Application to Cascadia and Other Regions" (Bulletin of the Seismological Society of America, Volume 93, Number 4, pages 1703-1929, 2003). The class implements the global model but not the corrections for Japan/Cascadia. SA values at 4 s (not supported by the original equations) are obtained from mean value at 3 s divided by a factor equal to 0.550 (scaling factor computed in the context of the SHARE project and obtained as average ratio between median values at 4 and 3 seconds as predicted by SHARE subduction GMPEs). The class implements the equations for 'Subduction IntraSlab' (that's why the class name ends with 'SSlab'). """#: Supported tectonic region type is subduction interfaceDEFINED_FOR_TECTONIC_REGION_TYPE=const.TRT.SUBDUCTION_INTRASLAB
[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. """# cap magnitude values at 8.0, see page 1709mag=np.clip(ctx.mag,0,8.0)# compute PGA on rock (needed for site amplification calculation)G=10**(0.301-0.01*mag)pga_rock=_compute_mean(self.kind,self.COEFFS_SSLAB[PGA()],G,mag,ctx.hypo_depth,ctx.rrup,ctx.vs30,# by passing pga_rock > 500 the soil# amplification is 0np.zeros_like(ctx.vs30)+600,PGA())pga_rock=10**pga_rockform,imtinenumerate(imts):C=self.COEFFS_SSLAB[imt]# compute actual mean and convert from log10 to ln and units from# cm/s**2 to gmean[m]=_compute_mean(self.kind,C,G,mag,ctx.hypo_depth,ctx.rrup,ctx.vs30,pga_rock,imt)mean[m]=np.log((10**mean[m])*1e-2/g)ifimt.period==4.0:mean[m]/=0.550sig[m]=np.log(10**C['sigma'])if's2'inC.dtype.names:# in the Gupta subclasstau[m]=np.log(10**C['s2'])phi[m]=np.log(10**C['s1'])
[docs]classAtkinsonBoore2003SInterNSHMP2008(AtkinsonBoore2003SInter):""" Extend :class:`AtkinsonBoore2003SInter` and introduces site amplification for B/C site condition and fixed rupture hypocentral depth (20 km) as defined by the National Seismic Hazard Mapping Project (NSHMP) for the 2008 US hazard model Site amplification for B/C is triggered when vs30 > 760 and it is computed as site amplification for C soil scaled by a factor equal to 0.5 The class implements the equation as coded in ``subroutine getABsub`` in ``hazSUBXnga.f`` Fortran code available at: http://earthquake.usgs.gov/hazards/products/conterminous/2008/software/ """kind='SInter2008'
[docs]classAtkinsonBoore2003SSlabNSHMP2008(AtkinsonBoore2003SSlab):""" Extend :class:`AtkinsonBoore2003SSlab` and introduces site amplification for B/C site condition as defined by the National Seismic Hazard Mapping Project (NSHMP) for the 2008 US hazard model. Site amplification for B/C is triggered when vs30 > 760 and it is computed as site amplification for C soil scaled by a factor equal to 0.5 The class replicates the equation as coded in ``subroutine getABsub`` in ``hazgridXnga2.f`` Fortran code available at: http://earthquake.usgs.gov/hazards/products/conterminous/2008/software/ """kind='SSlab2008'
[docs]classAtkinsonBoore2003SSlabCascadiaNSHMP2008(AtkinsonBoore2003SSlabNSHMP2008):""" Combines :class:`AtkinsonBoore2003SSlabNSHMP2008` for NSHMP site amplification with :class:`AtkinsonBoore2003SSlabCascadia` for Cascadia. """COEFFS_SSLAB=AtkinsonBoore2003SSlabCascadia.COEFFS_SSLAB
[docs]classAtkinsonBoore2003SSlabJapanNSHMP2008(AtkinsonBoore2003SSlabNSHMP2008):""" Combines :class:`AtkinsonBoore2003SSlabNSHMP2008` for NSHMP site amplification with :class:`AtkinsonBoore2003SSlabJapan` for Japan. Validation test vector was generated by applying increments in columns 1 and 2 of Table 3 to test vector for AtkinsonBoore2003SSlabCascadiaNSHMP2008. """COEFFS_SSLAB=AtkinsonBoore2003SSlabJapan.COEFFS_SSLAB