Source code for openquake.hazardlib.gsim.chao_2020
# -*- coding: utf-8 -*-# vim: tabstop=4 shiftwidth=4 softtabstop=4## Copyright (C) 2015-2018 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:`ChaoEtAl2020SInter` :class:`ChaoEtAl2020SSlab` :class:`ChaoEtAl2020Asc`"""importmathimportnumpyasnpfromopenquake.baselib.generalimportCallableDictfromopenquake.hazardlibimportconstfromopenquake.hazardlib.gsim.baseimportGMPE,CoeffsTablefromopenquake.hazardlib.imtimportPGA,PGD,PGV,SACONSTANTS={'mag_ref':6.5,'n':2,'vs30_ref':760,'rrup_ref':0}def_fc(C,imt,vs30,sa1180):""" C value factor [23]. """s=CONSTANTSifimt.stringin["PGD","PGV"]:c=2400else:c=2.4return(-1.5*np.log(vs30/s['vs30_ref'])-np.log(sa1180+c)+np.log(sa1180+c*(vs30/s['vs30_ref'])**1.5)) \
*np.heaviside(s['vs30_ref']-vs30,0.5)*C['c23']_ffault=CallableDict()@_ffault.add(const.TRT.SUBDUCTION_INTERFACE,const.TRT.SUBDUCTION_INTRASLAB)def_ffault_1(trt,MC,SUFFIX,C,mag):""" Other fault specific factors. """return(6-mag)*np.heaviside(6-mag,0.5)*C['c13'] \
+(mag-MC)*np.heaviside(mag-MC,0.5) \
*C['c29'+SUFFIX]@_ffault.add(const.TRT.ACTIVE_SHALLOW_CRUST)def_ffault_2(trt,MC,SUFFIX,C,mag):""" Other fault specific factors. """return((mag-CONSTANTS['mag_ref'])**2-(mag-MC)**2*np.heaviside(mag-MC,0.5))*C['c10']def_fh(trt,SBCR,MC,C4,C,mag,rrup):""" Factors using `h` (coefficients 17-22). """s=CONSTANTSiftrt==const.TRT.SUBDUCTION_INTERFACE:# H factor for coefficients 17-22h=10*np.exp(C4*(mag-MC)*np.heaviside(mag-MC,0.5))else:# ASCh=10.hf=np.log((rrup**s['n']+h**s['n'])**(1/s['n'])/(s['rrup_ref']**s['n']+h**s['n'])**(1/s['n']))iftrt==const.TRT.ACTIVE_SHALLOW_CRUST:c19=magelse:c19=np.minimum(mag,MC)returnhf*C['c17'+SBCR]+hf*C['c19'+SBCR]*(c19-s['mag_ref'])_ftype=CallableDict()@_ftype.add(const.TRT.SUBDUCTION_INTERFACE,const.TRT.SUBDUCTION_INTRASLAB)def_ftype_1(trt,suffix,C,ctx):""" Factor based on the type of fault. """returnC['c4'+suffix]@_ftype.add(const.TRT.ACTIVE_SHALLOW_CRUST)def_ftype_2(trt,suffix,C,ctx):""" Factor based on the type of fault. """res=np.full_like(ctx.rake,C['c2'])# strike-slipres[(30<=ctx.rake)&(ctx.rake<=150)]=C['c1']# reverseres[(-150<=ctx.rake)&(ctx.rake<=-30)]=C['c3']# normalreturnresdef_fvs30(geology,C,ctx):""" Source of Vs30 factor. vs30measured available for Kuo17 (measured) self.geology True for KS17 (inferred) self.geology False for Receiver Function (inferred) """returnnp.where(ctx.vs30measured,C['c26'],C['c27']ifgeologyelseC['c28'])def_get_basin_term(C,ctx,region=None):""" z1pt0 factor. """result=np.zeros_like(ctx.z1pt0)idx=ctx.z1pt0>=0ifsum(idx)==0:returnresultz1pt0_ref=np.exp(-4.08/2*np.log((ctx.vs30**2+355.4**2)/(1750**2+355.4**2)))result[idx]=np.log(ctx.z1pt0[idx]/z1pt0_ref)*C['c25']returnresult
[docs]defget_stddevs(f,C,mag):""" Standard deviation. tau: between event stddev ln(g) phis2s: between site stddev in ln(g) phiss: single station stddev in ln(g) """f_mag=0.5*(np.minimum(6.5,np.maximum(4.5,mag))-4.5)tau=C[f'tau1{f}']+(C[f'tau2{f}']-C[f'tau1{f}'])*f_magphiss=C[f'phiss1{f}']+(C[f'phiss2{f}']-C[f'phiss1{f}'])*f_magphis2s=C['phis2s']phi=np.sqrt(phis2s**2+phiss**2)return[np.sqrt(tau**2+phi**2),tau,phi]
[docs]classChaoEtAl2020SInter(GMPE):""" Chao et al. (2020) for Subduction Interface. """DEFINED_FOR_TECTONIC_REGION_TYPE=const.TRT.SUBDUCTION_INTERFACEDEFINED_FOR_INTENSITY_MEASURE_COMPONENT=const.IMC.GEOMETRIC_MEANDEFINED_FOR_INTENSITY_MEASURE_TYPES={PGA,PGD,PGV,SA}DEFINED_FOR_REFERENCE_VELOCITY=1180DEFINED_FOR_STANDARD_DEVIATION_TYPES={const.StdDev.TOTAL,const.StdDev.INTER_EVENT,const.StdDev.INTRA_EVENT}#: Required distance rrupREQUIRES_DISTANCES={'rrup'}REQUIRES_RUPTURE_PARAMETERS={'mag','ztor'}REQUIRES_SITES_PARAMETERS={'vs30','vs30measured','z1pt0'}REQUIRES_ATTRIBUTES={'manila','aftershocks','geology'}def__init__(self,manila=False,aftershocks=False,geology=True):# Manila or Ryukyu subduction zoneself.manila=manila# aftershocks or mainshocksself.aftershocks=aftershocks# geology True for KS17, False for seismic (receiver function)# only used for inferred vs30, otherwise use vs30measuredself.geology=geology
[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. """trt=self.DEFINED_FOR_TECTONIC_REGION_TYPEform,imtinenumerate(imts):C=self.COEFFS[imt]s=CONSTANTSmed=mean[m]med+=_ftype(trt,self.SUFFIX,C,ctx)med+=(ctx.ztor-self.CONST_FAULT['href'])*C['c14'+self.SUFFIX]med+=(ctx.mag-s['mag_ref'])*C['c8'+self.SBCR]med+=(5-ctx.mag)*np.heaviside(5-ctx.mag,0.5) \
*C['c11'+self.SBCR]med+=_fh(trt,self.SBCR,self.MC,self.CONST_FAULT['C4'],C,ctx.mag,ctx.rrup)med+=(ctx.rrup-s['rrup_ref'])*C['c21'+self.SBCR]med+=_ffault(trt,self.MC,self.SUFFIX,C,ctx.mag)med+=C['c6']*self.aftershocks+C['c7']*self.manilamed+=_fvs30(self.geology,C,ctx)sa1180=np.exp(med+math.log(1180/s['vs30_ref'])*C['c24'])med+=_fc(C,imt,ctx.vs30,sa1180)med+=np.log(ctx.vs30/s['vs30_ref'])*C['c24']med+=_get_basin_term(C,ctx)sig[m],tau[m],phi[m]=get_stddevs(self.SBCR,C,ctx.mag)
[docs]classChaoEtAl2020SSlab(ChaoEtAl2020SInter):""" Chao et al. (2020) for Subduction Slab. """DEFINED_FOR_TECTONIC_REGION_TYPE=const.TRT.SUBDUCTION_INTRASLABCONST_FAULT={'C4':0.2,'href':35}SUFFIX="_is"
[docs]classChaoEtAl2020Asc(ChaoEtAl2020SInter):""" Chao et al. (2020) for Crustal. """DEFINED_FOR_TECTONIC_REGION_TYPE=const.TRT.ACTIVE_SHALLOW_CRUST# add rake to determine fault style in _ftype()REQUIRES_RUPTURE_PARAMETERS={'mag','rake','ztor'}CONST_FAULT={'C4':0,'href':0}# subduction or crustalSBCR="_cr"SUFFIX="_cr"MC=7.6