Example #1
0
def example_calc(apply):
    sitecol = SiteCollection([
        Site(Point(30.0, 30.0), 760., 1.0, 1.0),
        Site(Point(30.25, 30.25), 760., 1.0, 1.0),
        Site(Point(30.4, 30.4), 760., 1.0, 1.0)
    ])
    mfd_1 = TruncatedGRMFD(4.5, 8.0, 0.1, 4.0, 1.0)
    mfd_2 = TruncatedGRMFD(4.5, 7.5, 0.1, 3.5, 1.1)
    sources = [
        PointSource('001', 'Point1', 'Active Shallow Crust', mfd_1, 1.0,
                    WC1994(), 1.0, PoissonTOM(50.0), 0.0, 30.0,
                    Point(30.0, 30.5), PMF([(1.0, NodalPlane(0.0, 90.0,
                                                             0.0))]),
                    PMF([(1.0, 10.0)])),
        PointSource('002', 'Point2', 'Active Shallow Crust', mfd_2, 1.0,
                    WC1994(), 1.0, PoissonTOM(50.0), 0.0, 30.0,
                    Point(30.0, 30.5), PMF([(1.0, NodalPlane(0.0, 90.0,
                                                             0.0))]),
                    PMF([(1.0, 10.0)]))
    ]
    imtls = {
        'PGA': [0.01, 0.1, 0.2, 0.5, 0.8],
        'SA(0.5)': [0.01, 0.1, 0.2, 0.5, 0.8]
    }
    gsims = {'Active Shallow Crust': AkkarBommer2010()}
    return calc_hazard_curves(sources,
                              sitecol,
                              imtls,
                              gsims,
                              apply=apply,
                              filter_distance='rrup')
 def test(self):
     sitecol = SiteCollection([Site(Point(30.0, 30.0), 760., 1.0, 1.0)])
     mfd = TruncatedGRMFD(4.5, 8.0, 0.1, 4.0, 1.0)
     sources = [PointSource('001', 'Point1', 'Active Shallow Crust',
                            mfd, 1.0, WC1994(), 1.0, PoissonTOM(50.0),
                            0.0, 30.0, Point(30.0, 30.5),
                            PMF([(1.0, NodalPlane(0.0, 90.0, 0.0))]),
                            PMF([(1.0, 10.0)]))]
     imtls = {'PGA': [0.01, 0.1, 0.2, 0.5, 0.8]}
     hc1 = calc_hazard_curves(sources, sitecol, imtls, {
         'Active Shallow Crust': AkkarBommer2010()})['PGA']
     hc2 = calc_hazard_curves(sources, sitecol, imtls, {
         'Active Shallow Crust': SadighEtAl1997()})['PGA']
     hc = .6 * hc1 + .4 * hc2
     ag = AvgGMPE(b1=dict(AkkarBommer2010={'weight': .6}),
                  b2=dict(SadighEtAl1997={'weight': .4}))
     hcm = calc_hazard_curves(sources, sitecol, imtls, {
         'Active Shallow Crust': ag})['PGA']
     # the AvgGMPE is not producing real means!!
     numpy.testing.assert_almost_equal(hc, hcm, decimal=3)