def compute(self, ctx, imts, mean, sig, tau, phi): """ See :meth:`superclass method <.base.GroundShakingIntensityModel.compute>` for spec of input and result values. """ for m, imt in enumerate(imts): C = self.COEFFS[imt] if self.kind == 'Mblg': mag = mblg_to_mw_johnston_96(ctx.mag) elif self.kind == 'Mblg2008': mag = mblg_to_mw_atkinson_boore_87(ctx.mag) else: mag = ctx.mag # computing the magnitude term. Equation 19, page 2291 f1 = _compute_magnitude_scaling_term(C, mag) # computing the geometrical spreading term. Equation 20, page 2291 f2 = _compute_geometrical_spreading_term(C, ctx.rrup) # computing the anelastic attenuation term. Equation 21, page 2291 f3 = _compute_anelastic_attenuation_term(C, ctx.rrup, mag) # computing the mean ln(IMT) using equation 18 at page 2290 mean[m] = f1 + f2 + f3 if self.kind != 'base': # in subclasses mean[m] = clip_mean(imt, mean[m]) # computing the total standard deviation sig[m] = (C['c14'] + C['c15'] * mag) if mag < 7.2 else C['c16']
def _convert_magnitude(mag_eq, mag): """ Convert magnitude from Mblg to Mw using various equations equation """ if mag_eq == 'Mblg87': return mblg_to_mw_atkinson_boore_87(mag) elif mag_eq == 'Mblg96': return mblg_to_mw_johnston_96(mag) elif mag_eq == 'Mw': return mag
def _compute_finite_fault_correction(self, mag): """ Compute finite fault correction term as geometric mean of correction terms obtained from Mw values calculated with Johnston 1996 and Atkinson and Boore 1987 conversion equations. Implement equations as in lines 1653 - 1658 in hazgridXnga2.f """ mw_j96 = mblg_to_mw_johnston_96(mag) mw_ab87 = mblg_to_mw_atkinson_boore_87(mag) t1 = np.exp(-1.25 + 0.227 * mw_j96) t2 = np.exp(-1.25 + 0.227 * mw_ab87) return np.sqrt(t1 * t2)
def _compute_finite_fault_correction_Mblg(kind, mag): """ Compute finite fault correction term as geometric mean of correction terms obtained from Mw values calculated with Johnston 1996 and Atkinson and Boore 1987 conversion equations. Implement equations as in lines 1653 - 1658 in hazgridXnga2.f """ mw_j96 = mblg_to_mw_johnston_96(mag) mw_ab87 = mblg_to_mw_atkinson_boore_87(mag) t1 = np.exp(-1.25 + 0.227 * mw_j96) t2 = np.exp(-1.25 + 0.227 * mw_ab87) return np.sqrt(t1 * t2)
def _convert_magnitude(self, mag): """ Convert magnitude from Mblg to Mw using Johnston 1996 equation """ return mblg_to_mw_johnston_96(mag)
def test_mblg_to_mw_johnston_96(self): mblg = 5 mw = mblg_to_mw_johnston_96(mblg) self.assertAlmostEqual(mw, 4.6725)
def _convert_magnitude(self, mag): """ Convert magnitude from Mblg to Mw using Johnston 1996 equation """ return mblg_to_mw_johnston_96(mag)
def test_mblg_to_mw_johnston_96(self): mblg = 5 mw = mblg_to_mw_johnston_96(mblg) self.assertAlmostEqual(mw, 4.6725)