Source code for openquake.hazardlib.gsim.bozorgnia_campbell_2016_vh
# -*- 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:`BozorgniaCampbell2016VH` :class:`BozorgniaCampbell2016HighQVH` :class:`BozorgniaCampbell2016LowQVH` :class:`BozorgniaCampbell2016AveQJapanSiteVH` :class:`BozorgniaCampbell2016HighQJapanSiteVH` :class:`BozorgniaCampbell2016LowQJapanSiteVH`"""importnumpyasnpfromopenquake.hazardlib.gsim.baseimportGMPE,CoeffsTablefromopenquake.hazardlibimportconst,contextsfromopenquake.hazardlib.imtimportPGA,PGV,SAfromopenquake.hazardlib.gsimimportbozorgnia_campbell_2016fromopenquake.hazardlib.gsimimportcampbell_bozorgnia_2014def_get_tau_vh(C,mag,tau_v,tau_h):""" Returns the inter-event random effects coefficient (tau) defined in Equation 10. """rhob1=C['rhob1']rhob2=C['rhob2']rhob=rhob2+(rhob1-rhob2)*(5.5-mag)rhob[mag<=4.5]=rhob1rhob[mag>=5.5]=rhob2returnnp.sqrt(tau_v**2+tau_h**2-2*rhob*tau_v*tau_h)def_get_phi_vh(C,mag,phi_v,phi_h):""" Returns the intra-event random effects coefficient (phi) defined in Equation 11. """rhow1=C['rhow1']rhow2=C['rhow2']rhow=rhow2+(rhow1-rhow2)*(5.5-mag)rhow[mag<=4.5]=rhow1rhow[mag>=5.5]=rhow2returnnp.sqrt(phi_v**2+phi_h**2-2*rhow*phi_v*phi_h)
[docs]classBozorgniaCampbell2016VH(GMPE):""" Implements the GMPE by Bozorgnia & Campbell (2016) vertical-to-horizontal ratio for ground motions from the PEER NGA-West2 Project This V/H model is combined from VGMPE by Bozorgnia and Campbell (2016) as the vertical model, and HGMPE by Campbell and Bozorgnia (2014) as the horizontal model. **Reference:** Bozorgnia, Y. & Campbell, K. (2016). Ground Motion Model for the Vertical-to-Horizontal (V/H) Ratios of PGA, PGV, and Response Spectra *Earthquake Spectra*, 32(2), 951-978. Implements the global model that uses datasets from California, Taiwan, the Middle East, and other similar active tectonic regions to represent a typical or average Q region. Applies the average attenuation case (Dc20=0) """VGMPE=bozorgnia_campbell_2016.BozorgniaCampbell2016()HGMPE=campbell_bozorgnia_2014.CampbellBozorgnia2014()#: Supported tectonic region type is active shallow crustDEFINED_FOR_TECTONIC_REGION_TYPE=const.TRT.ACTIVE_SHALLOW_CRUST#: Supported intensity measure types are spectral acceleration, peak#: ground velocity and peak ground accelerationDEFINED_FOR_INTENSITY_MEASURE_TYPES={PGA,PGV,SA}#: Supported intensity measure component is the#: :attr:`~openquake.hazardlib.const.IMC.VERTICAL_TO_HORIZONTAL_RATIO`DEFINED_FOR_INTENSITY_MEASURE_COMPONENT=(const.IMC.VERTICAL_TO_HORIZONTAL_RATIO)#: Supported standard deviation types are inter-event, intra-event#: and total; see the section for "Aleatory Variability Model".DEFINED_FOR_STANDARD_DEVIATION_TYPES={const.StdDev.TOTAL,const.StdDev.INTER_EVENT,const.StdDev.INTRA_EVENT}#: Required site parameters are taken from the V and H modelsREQUIRES_SITES_PARAMETERS=(VGMPE.REQUIRES_SITES_PARAMETERS|HGMPE.REQUIRES_SITES_PARAMETERS)#: Required rupture parameters are taken from the V and H modelsREQUIRES_RUPTURE_PARAMETERS=(VGMPE.REQUIRES_RUPTURE_PARAMETERS|HGMPE.REQUIRES_RUPTURE_PARAMETERS)#: Required distance measures are taken from the V and H modelsREQUIRES_DISTANCES=(VGMPE.REQUIRES_DISTANCES|HGMPE.REQUIRES_DISTANCES)
[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. """mean_,_sig,tau_,phi_=contexts.get_mean_stds([self.VGMPE,self.HGMPE],ctx,imts)form,imtinenumerate(imts):# V/H model, Equation 1 and 12 (in natural log units)mean[m]=mean_[0,m]-mean_[1,m]# Get standard deviationsC=self.COEFFS[imt]t=_get_tau_vh(C,ctx.mag,tau_[0,m],tau_[1,m])p=_get_phi_vh(C,ctx.mag,phi_[0,m],phi_[1,m])sig[m]=np.sqrt(t**2+p**2)tau[m]=tphi[m]=p
[docs]classBozorgniaCampbell2016HighQVH(BozorgniaCampbell2016VH):""" Implements the GMPE by Bozorgnia & Campbell (2016) vertical-to-horizontal ratio for ground motions from the PEER NGA-West2 Project Applies regional corrections in path scaling term for regions with low attenuation (high quality factor, Q) (e.g. eastern China) """VGMPE=bozorgnia_campbell_2016.BozorgniaCampbell2016(sgn=+1)HGMPE=campbell_bozorgnia_2014.CampbellBozorgnia2014(coeffs=campbell_bozorgnia_2014.coeffs_high)
[docs]classBozorgniaCampbell2016LowQVH(BozorgniaCampbell2016VH):""" Implements the GMPE by Bozorgnia & Campbell (2016) vertical-to-horizontal ratio for ground motions from the PEER NGA-West2 Project Applies regional corrections in path scaling term for regions with high attenuation (low quality factor, Q) (e.g. Japan and Italy) """VGMPE=bozorgnia_campbell_2016.BozorgniaCampbell2016(sgn=-1)HGMPE=campbell_bozorgnia_2014.CampbellBozorgnia2014(coeffs=campbell_bozorgnia_2014.coeffs_low)
[docs]classBozorgniaCampbell2016AveQJapanSiteVH(BozorgniaCampbell2016VH):""" Implements the GMPE by Bozorgnia & Campbell (2016) vertical-to-horizontal ratio for ground motions from the PEER NGA-West2 Project Incorporates the difference in linear Vs30 scaling for sites in Japan by activating the flag variable in shallow site reponse scaling Applies the average attenuation case (Dc20=0) """VGMPE=bozorgnia_campbell_2016.BozorgniaCampbell2016(SJ=1)HGMPE=campbell_bozorgnia_2014.CampbellBozorgnia2014(SJ=1)
[docs]classBozorgniaCampbell2016HighQJapanSiteVH(BozorgniaCampbell2016AveQJapanSiteVH):""" Implements the GMPE by Bozorgnia & Campbell (2016) vertical-to-horizontal ratio for ground motions from the PEER NGA-West2 Project Incorporates the difference in linear Vs30 scaling for sites in Japan by activating the flag variable in shallow site reponse scaling Applies regional corrections in path scaling term for regions with low attenuation (high quality factor, Q) """VGMPE=bozorgnia_campbell_2016.BozorgniaCampbell2016(SJ=1,sgn=+1)HGMPE=campbell_bozorgnia_2014.CampbellBozorgnia2014(coeffs=campbell_bozorgnia_2014.coeffs_high,SJ=1)
[docs]classBozorgniaCampbell2016LowQJapanSiteVH(BozorgniaCampbell2016AveQJapanSiteVH):""" Implements the GMPE by Bozorgnia & Campbell (2016) vertical-to-horizontal ratio for ground motions from the PEER NGA-West2 Project Incorporates the difference in linear Vs30 scaling for sites in Japan by activating the flag variable in shallow site reponse scaling Applies regional corrections in path scaling term for regions with high attenuation (low quality factor, Q) """VGMPE=bozorgnia_campbell_2016.BozorgniaCampbell2016(SJ=1,sgn=-1)HGMPE=campbell_bozorgnia_2014.CampbellBozorgnia2014(coeffs=campbell_bozorgnia_2014.coeffs_low,SJ=1)