Source code for openquake.hazardlib.gsim.sadigh_1997
# -*- coding: utf-8 -*-# vim: tabstop=4 shiftwidth=4 softtabstop=4## Copyright (C) 2012-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:`SadighEtAl1997`."""importnumpyasnpfromopenquake.hazardlib.gsim.baseimportGMPE,CoeffsTablefromopenquake.hazardlibimportconstfromopenquake.hazardlib.imtimportPGA,SA#: IMT-independent coefficients for deep soil ctx (table 4).COEFFS_SOIL_IMT_INDEPENDENT={'c1ss':-2.17,'c1r':-1.92,'c2':1.0,'c3':1.7,'c4lowmag':2.1863,'c5lowmag':0.32,'c4himag':0.3825,'c5himag':0.5882}#: If site vs30 is more than 750 m/s -- treat the soil as rock.#: See page 180.ROCK_VS30=750#: Magnitude value to separate coefficients table because of near field#: saturation effect is 6.5. See page 184.NEAR_FIELD_SATURATION_MAG=6.5
[docs]defget_mean_deep_soil(mag,rrup,is_reverse,C):""" Calculate and return the mean intensity for deep soil ctx. Implements an equation from table 4. """c1=np.where(is_reverse,COEFFS_SOIL_IMT_INDEPENDENT['c1r'],COEFFS_SOIL_IMT_INDEPENDENT['c1ss'])c2=COEFFS_SOIL_IMT_INDEPENDENT['c2']c3=COEFFS_SOIL_IMT_INDEPENDENT['c3']c4=np.where(mag<=NEAR_FIELD_SATURATION_MAG,COEFFS_SOIL_IMT_INDEPENDENT['c4lowmag'],COEFFS_SOIL_IMT_INDEPENDENT['c4himag'])c5=np.where(mag<=NEAR_FIELD_SATURATION_MAG,COEFFS_SOIL_IMT_INDEPENDENT['c5lowmag'],COEFFS_SOIL_IMT_INDEPENDENT['c5himag'])c6=np.where(is_reverse,C['c6r'],C['c6ss'])# clip mag if greater than 8.5. This is to avoid# ValueError: negative number cannot be raised to a fractional powermag=np.clip(mag,None,8.5)return(c1+c2*mag+c6+C['c7']*((8.5-mag)**2.5)-c3*np.log(rrup+c4*np.exp(c5*mag)))
[docs]defget_mean_rock(mag,rrup,is_reverse,low_coeffs,hi_coeffs):""" Calculate and return the mean intensity for rock ctx. Implements an equation from table 2. """# clip mag if greater than 8.5. This is to avoid# ValueError: negative number cannot be raised to a fractional powermag=np.clip(mag,None,8.5)# determine the coefficients to use depending on the magC=np.where(mag<=NEAR_FIELD_SATURATION_MAG,low_coeffs,hi_coeffs)# compute the meanmean=(C['c1']+C['c2']*mag+C['c3']*((8.5-mag)**2.5)+C['c4']*np.log(rrup+np.exp(C['c5']+C['c6']*mag))+C['c7']*np.log(rrup+2))# footnote in table 2 says that for reverse ruptures# the mean amplitude value should be multiplied by 1.2mean[is_reverse]+=0.1823215567939546# == log(1.2)returnmean
[docs]defget_stddev_rock(mag,C):""" Calculate and return total standard deviation for rock ctx. Implements formulae from table 3. """returnnp.where(mag>C['maxmag'],C['maxsigma'],C['sigma0']+C['magfactor']*mag)
[docs]defget_stddev_deep_soil(mag,C):""" Calculate and return total standard deviation for deep soil ctx. Implements formulae from the last column of table 4. """# footnote from table 4 says that stderr for magnitudes over 7# is equal to one of magnitude 7.returnC['sigma0']+C['magfactor']*np.clip(mag,None,7)
[docs]classSadighEtAl1997(GMPE):""" Implements GMPE developed by Sadigh, K., C. -Y. Chang, J. A. Egan, F. Makdisi, and R. R. Youngs (1997) and published as "Attenuation relationships for shallow crustal earthquakes based on California strong motion data", Seismological Research Letters, 68(1), 180-189. """#: Supported tectonic region type is active shallow crust,#: since data consists of California earthquakes mainly.DEFINED_FOR_TECTONIC_REGION_TYPE=const.TRT.ACTIVE_SHALLOW_CRUST#: Supported intensity measure types are spectral acceleration,#: and peak ground acceleration, see page 180.DEFINED_FOR_INTENSITY_MEASURE_TYPES={PGA,SA}#: Supported intensity measure component is the geometric mean of#: two : horizontal components#: :attr:`~openquake.hazardlib.const.IMC.GEOMETRIC_MEAN`, : see#: page 180.DEFINED_FOR_INTENSITY_MEASURE_COMPONENT=const.IMC.GEOMETRIC_MEAN#: Supported standard deviation type is only total, see table 3.DEFINED_FOR_STANDARD_DEVIATION_TYPES={const.StdDev.TOTAL}#: Required site parameter is only Vs30 (used to distinguish rock#: and deep soil).REQUIRES_SITES_PARAMETERS={'vs30'}#: Required rupture parameters are magnitude and rake (eq. 1).REQUIRES_RUPTURE_PARAMETERS={'rake','mag'}#: Required distance measure is RRup (eq. 1).REQUIRES_DISTANCES={'rrup'}
[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. """# GMPE differentiates strike-slip, reverse and normal ruptures,# but combines normal and strike-slip into one category. See page 180.reverse=(45<=ctx.rake)&(ctx.rake<=135)is_rock=ctx.vs30>ROCK_VS30is_soil=ctx.vs30<=ROCK_VS30mag_r=ctx.mag[is_rock]mag_s=ctx.mag[is_soil]rrup_r=ctx.rrup[is_rock]rrup_s=ctx.rrup[is_soil]reverse_r=reverse[is_rock]reverse_s=reverse[is_soil]form,imtinenumerate(imts):mean[m,is_rock]=get_mean_rock(mag_r,rrup_r,reverse_r,self.COEFFS_ROCK_LOWMAG[imt],self.COEFFS_ROCK_HIMAG[imt])sig[m,is_rock]=get_stddev_rock(mag_r,self.COEFFS_ROCK_STDDERR[imt])mean[m,is_soil]=get_mean_deep_soil(mag_s,rrup_s,reverse_s,self.COEFFS_SOIL[imt])sig[m,is_soil]=get_stddev_deep_soil(mag_s,self.COEFFS_SOIL[imt])