Source code for openquake.hazardlib.gsim.megawati_2003
# -*- 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:`megawatiEtAl2003`."""importnumpyasnpfromscipy.constantsimportgfromopenquake.hazardlib.gsim.baseimportGMPE,CoeffsTablefromopenquake.hazardlibimportconstfromopenquake.hazardlib.imtimportPGA,PGV,SAdef_get_azimuth_correction(coe,azimuth):""" This is the azimuth correction defined in the functional form (see equation 3 at page 2256) """term1=abs(np.cos(np.radians(2.*azimuth)))term2=abs(np.sin(np.radians(2.*azimuth)))*coe['a5']returnnp.log(np.max(np.hstack((term1,term2))))def_get_distance_scaling(coe,rhypo):""" Returns the distance scaling term """returncoe["a3"]*np.log(rhypo)+coe["a4"]*rhypodef_get_magnitude_scaling(coe,mag):""" Returns the magnitude scaling term """returncoe["a0"]+coe["a1"]*mag+coe["a2"]*mag**2.
[docs]classMegawatiEtAl2003(GMPE):""" Implements GMPE developed by Megawati, Pan and Koketsu and published in 2003 as "Response spectral attenuation relationships for Singapore and the Malay Peninsula due to distant Sumatran-fault earthquakes", Earthquake Engineering & Structural Dynamics Volume 32, pages 2241–2265. """#: Supported tectonic region type is active shallow crust#: Sumatra strike-slip faultDEFINED_FOR_TECTONIC_REGION_TYPE=const.TRT.ACTIVE_SHALLOW_CRUST#: Supported intensity measure types are spectral acceleration,#: peak ground veloacity and peak ground accelerationDEFINED_FOR_INTENSITY_MEASURE_TYPES={PGA,PGV,SA}#: Supported intensity measure component is geometric mean#: of two horizontal components,DEFINED_FOR_INTENSITY_MEASURE_COMPONENT=const.IMC.GEOMETRIC_MEAN#: Supported standard deviation types is totalDEFINED_FOR_STANDARD_DEVIATION_TYPES={const.StdDev.TOTAL}#: No site parameter required. This GMPE is for very hard rock conditionsREQUIRES_SITES_PARAMETERS=set()#: Required rupture parameter is magnitudeREQUIRES_RUPTURE_PARAMETERS={'mag'}#: Required distance measure is hypocentral distance, and azimuthREQUIRES_DISTANCES={'rhypo','azimuth'}
[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):coe=self.COEFFS[imt]mean[m]=(_get_magnitude_scaling(coe,ctx.mag)+_get_distance_scaling(coe,ctx.rhypo)+_get_azimuth_correction(coe,ctx.azimuth))# Convert to gifimt.string.startswith(("PGA","SA")):mean[m]=np.log(np.exp(mean[m])/(100.0*g))# Compute stdsig[m]=coe['sigma']