Source code for openquake.hazardlib.gsim.drouet_2015_brazil
# -*- 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:`DrouetBrazil2015` :class:`DrouetBrazil2015_with_depth`"""importnumpyasnpfromopenquake.baselib.generalimportCallableDictfromopenquake.hazardlib.gsim.baseimportCoeffsTable,GMPEfromopenquake.hazardlibimportconstfromopenquake.hazardlib.imtimportPGA,PGV,SAfromscipy.constantsimportg_compute_distance_term=CallableDict()@_compute_distance_term.add(False)def_compute_distance_term_1(depth,C,ctx,rjb):""" This computes the term f2 equation 8 Drouet & Cotton (2015) """return(C['c4']+C['c5']*ctx.mag)*np.log(np.sqrt(rjb**2.+C['c6']**2.))+C['c7']*rjb@_compute_distance_term.add(True)def_compute_distance_term_2(depth,C,ctx,rjb):""" This computes the term f2 equation 8 Drouet & Cotton (2015) """return(C['c4']+C['c5']*ctx.mag)*np.log(np.sqrt(rjb**2.+ctx.hypo_depth**2.))+C['c6']*rjbdef_compute_magnitude_term(C,ctx):""" This computes the term f1 equation 8 Drouet & Cotton (2015) """returnC['c2']*(ctx.mag-8.0)+C['c3']*(ctx.mag-8.0)**2def_compute_mean(depth,C,ctx,rjb):""" Compute mean value according to equation 30, page 1021. """mean=(C['c1']+_compute_magnitude_term(C,ctx)+_compute_distance_term(depth,C,ctx,rjb))returnmean
[docs]classDrouetBrazil2015(GMPE):""" Implements GMPE developed by S. Drouet unpublished for Brazil based on the method described in Douet & Cotton (2015) BSSA doi: 10.1785/0120140240. """#: Supported tectonic region type is stable continental crust given that#: the equations have been derived for Eastern North America.DEFINED_FOR_TECTONIC_REGION_TYPE=const.TRT.STABLE_CONTINENTAL#: Supported intensity measure types are spectral acceleration,#: and peak ground acceleration, see table 6, page 1022 (PGA is assumed#: to be equal to SA at 0.01 s)DEFINED_FOR_INTENSITY_MEASURE_TYPES={PGA,PGV,SA}#: Supported intensity measure component is the geometric mean of#: two horizontal components#: :attr:`~openquake.hazardlib.const.IMC.GEOMETRIC_MEAN`,DEFINED_FOR_INTENSITY_MEASURE_COMPONENT=const.IMC.GEOMETRIC_MEAN#: Supported standard deviation type is only total, see equation 35, page#: 1021DEFINED_FOR_STANDARD_DEVIATION_TYPES={const.StdDev.TOTAL,const.StdDev.INTER_EVENT,const.StdDev.INTRA_EVENT}#: No site parameters are neededREQUIRES_SITES_PARAMETERS=set()#: Required rupture parameter is only magnitude, see equation 30 page#: 1021.REQUIRES_RUPTURE_PARAMETERS={'mag'}#: Required distance measure is closest distance to rupture, see equation#: 30 page 1021.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]depth="hypo_depth"inself.REQUIRES_RUPTURE_PARAMETERSmean[m]=_compute_mean(depth,C,ctx,ctx.rjb)ifimt.string.startswith(('PGA','SA')):# from m/s**2 to gmean[m]-=np.log(g)elifimt.string=="PGV":# Convert from m/s to cm/smean[m]+=np.log(100.0)sig[m]=np.sqrt(C['sigma']**2+C['tau']**2)phi[m]=C['sigma']tau[m]=C['tau']