Exemplo n.º 1
0
 def setUp(self):
     """
     Builds a simple dipping/bending fault source with a characteristic
     source model. Compares the curves for four sites, two on the hanging
     wall and two on the footwall.
     The source model is taken from the PEER Tests
     """
     point_order_dipping_east = [Point(-64.78365, -0.45236),
                                 Point(-64.80164, -0.45236),
                                 Point(-64.90498, -0.36564),
                                 Point(-65.0000, -0.16188),
                                 Point(-65.0000, 0.0000)]
     trace_dip_east = Line(point_order_dipping_east)
     site_1 = Site(Point(-64.98651, -0.15738), 760.0, 48.0, 0.607,
                   vs30measured=True)
     site_2 = Site(Point(-64.77466, -0.45686), 760.0, 48.0, 0.607,
                   vs30measured=True)
     site_3 = Site(Point(-64.92747, -0.38363), 760.0, 48.0, 0.607,
                   vs30measured=True)
     site_4 = Site(Point(-65.05396, -0.17088), 760.0, 48.0, 0.607,
                   vs30measured=True)
     self.sites = SiteCollection([site_1, site_2, site_3, site_4])
     self.imtls = {"PGA": [0.001, 0.01, 0.05, 0.1, 0.15, 0.2, 0.25, 0.3,
                           0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.7, 0.8, 0.9,
                           1.0]}
     fault_surface1 = SimpleFaultSurface.from_fault_data(
         trace_dip_east, 0.0, 12.0, 60., 0.5)
     mfd1 = EvenlyDiscretizedMFD(6.75, 0.01, [0.01])
     tom = PoissonTOM(1.0)
     self.sources = [
         CharacteristicFaultSource(
             "PEER_CHAR_FLT_EAST",
             "Peer Bending Fault Dipping East - Characteristic",
             "Active Shallow Crust",
             mfd1,
             tom,
             fault_surface1,
             90.0)]
     # We will check all the GMPEs
     self.gsim_set = {
         "ASK": [AbrahamsonEtAl2014NSHMPMean(),
                 (0.185, AbrahamsonEtAl2014NSHMPLower()),
                 (0.63, AbrahamsonEtAl2014()),
                 (0.185, AbrahamsonEtAl2014NSHMPUpper())],
         "BSSA": [BooreEtAl2014NSHMPMean(),
                  (0.185, BooreEtAl2014NSHMPLower()),
                  (0.63, BooreEtAl2014()),
                  (0.185, BooreEtAl2014NSHMPUpper())],
         "CB": [CampbellBozorgnia2014NSHMPMean(),
                (0.185, CampbellBozorgnia2014NSHMPLower()),
                (0.63, CampbellBozorgnia2014()),
                (0.185, CampbellBozorgnia2014NSHMPUpper())],
         "CY": [ChiouYoungs2014NSHMPMean(),
                (0.185, ChiouYoungs2014NSHMPLower()),
                (0.63, ChiouYoungs2014()),
                (0.185, ChiouYoungs2014NSHMPUpper())],
         "ID": [Idriss2014NSHMPMean(),
                (0.185, Idriss2014NSHMPLower()),
                (0.63, Idriss2014()),
                (0.185, Idriss2014NSHMPUpper())]}
Exemplo n.º 2
0
def _setup_fault_source():
    """
    Builds a fault source using the PEER Bending Fault case.
    """
    point_order_dipping_east = [
        Point(-64.78365, -0.45236),
        Point(-64.80164, -0.45236),
        Point(-64.90498, -0.36564),
        Point(-65.0000, -0.16188),
        Point(-65.0000, 0.0000)
    ]
    trace_dip_east = Line(point_order_dipping_east)
    fault_surface1 = SimpleFaultSurface.from_fault_data(
        trace_dip_east, 0.0, 12.0, 60., 1.0)
    # Activity Rates
    # cm per km2
    area = 60. * 12.0 / np.sin(np.radians(60.))
    cm2perkm2 = (100. * 1000.)**2.
    mo1 = 3.0E11 * 0.2 * (area * cm2perkm2)
    mo_m6p75 = 10.0**(16.05 + 1.5 * 6.75)
    rate1 = mo1 / mo_m6p75
    mfd1 = EvenlyDiscretizedMFD(6.75, 0.01, [rate1])
    tom = PoissonTOM(1.0)
    aspect = 2.0
    rake = 90.0
    src = SimpleFaultSource("PEER_FLT_EAST", "PEER Bending Fault Dipping East",
                            "Active Shallow Crust", mfd1, 1.0, PeerMSR(), 2.0,
                            tom, 0.0, 12.0, trace_dip_east, 60.0, rake)
    src.num_ruptures = src.count_ruptures()
    return src
def fault_shapefile_to_dictionary(filename, mesh_spacing=1.0):
    """
    
    """
    sf = shapefile.Reader(filename)
    data = []
    fields = [val[0] for val in sf.fields[1:]]
    for rec in sf.shapeRecords():
        rec_data = dict([(field, rec.record[i])
                         for i, field in enumerate(fields)])
        # Parse geometry
        rec_data["geometry"] = np.array(rec.shape.points)
        data.append(rec_data)
    # Cleanup dict
    cleaned_data = []
    for rec in data:
        cleaned_rec = {}
        cleaned_rec["ID"] = rec["IDSOURCE"]
        cleaned_rec["dip"] = (rec["DIPMIN"], rec["DIPMAX"])
        cleaned_rec["name"] = rec["SOURCENAME"]
        cleaned_rec["rake"] = (rec["RAKEMIN"], rec["RAKEMAX"])
        cleaned_rec["LSD"] = rec["MAXDEPTH"]
        cleaned_rec["USD"] = rec["MINDEPTH"]
        cleaned_rec["slip"] = (rec["SRMIN"], rec["SRMAX"])
        # Build surfaces
        cleaned_rec["trace"] = Line(
            [Point(row[0], row[1]) for row in rec["geometry"]])
        cleaned_rec["surfaces"] = (
            SimpleFaultSurface.from_fault_data(
                cleaned_rec["trace"],
                cleaned_rec["USD"],
                cleaned_rec["LSD"],
                cleaned_rec["dip"][1],  # Highest dip -> smallest area
                mesh_spacing),
            SimpleFaultSurface.from_fault_data(
                cleaned_rec["trace"],
                cleaned_rec["USD"],
                cleaned_rec["LSD"],
                cleaned_rec["dip"][0],  # Lowest dip -> largest area
                mesh_spacing))
        cleaned_data.append(cleaned_rec)
    return cleaned_data
Exemplo n.º 4
0
def simple_fault_surface_from_dict(data, mesh_spacing=1.):
    """
    Builds a simple fault surface from the json load
    """
    assert "SimpleFaultSurface" in data
    trace = []
    for lon, lat in data["trace"]:
        trace.append(Point(lon, lat, 0.0))
    trace = Line(trace)
    return SimpleFaultSurface.from_fault_data(trace, data["upperSeismoDepth"],
                                              data["lowerSeismoDepth"],
                                              data["dip"], mesh_spacing)
def trace_to_surface(trace, **kwargs):
    coords = trace['geometry']['coordinates'][0]
    point_list = [Point(*c) for c in coords]

    sfs_args = kwargs

    if 'dip' not in sfs_args:
        sfs_args['dip'] = trace['properties']['dip']

    sfs = SimpleFaultSurface.from_fault_data(fault_trace=Line(point_list),
                                             **sfs_args)
    return sfs
Exemplo n.º 6
0
def simple_fault_surface_from_dict(data, mesh_spacing=1.):
    """
    Builds a simple fault surface from the json load
    """
    assert "SimpleFaultSurface" in data
    trace = []
    for lon, lat in data["trace"]:
        trace.append(Point(lon, lat, 0.0))
    trace = Line(trace)
    return SimpleFaultSurface.from_fault_data(trace, data["upperSeismoDepth"],
                                              data["lowerSeismoDepth"],
                                              data["dip"], mesh_spacing)
Exemplo n.º 7
0
def _setup_peer_test_bending_fault_config():
    """
    The GC2 tests will be based on variations of the PEER bending fault
    test case:

    (Fault is dipping east north east
    Point 5 (-65.0, 0.0, 0.0)
        o
        |
        |
        |
        o Point 4 (-65.0, -0.16188, 0)
         \
          \
           \
            \
             \
              o Point 3 (-64.90498, -0.36564, 0.0)
               \__
                  \__
                     \__
                        \__
                           \__Point 2 (-64.80164, -0.45236, 0.0)
                              \o---o Point 1 (-64.78365, -0.45236, 0.0)
    """
    # Build separate faults
    # Get down-dip points - dipping east-noth-east
    strike1 = PNT1.azimuth(PNT2)
    dipdir1 = (strike1 + 90.) % 360.0

    strike2 = PNT2.azimuth(PNT3)
    dipdir2 = (strike2 + 90.) % 360.0

    strike3 = PNT3.azimuth(PNT4)
    dipdir3 = (strike3 + 90.) % 360.0

    strike4 = PNT4.azimuth(PNT5)
    dipdir4 = (strike4 + 90.) % 360.0

    global_strike = PNT1.azimuth(PNT5)
    global_dipdir = (global_strike + 90.) % 360.0
    # Get lower trace
    usd = 0.0
    lsd = 12.0
    dip = 60.0
    as_length = lsd / numpy.tan(numpy.radians(dip))
    PNT1b = PNT1.point_at(as_length, lsd, global_dipdir)
    PNT2b = PNT2.point_at(as_length, lsd, global_dipdir)
    PNT3b = PNT3.point_at(as_length, lsd, global_dipdir)
    PNT4b = PNT4.point_at(as_length, lsd, global_dipdir)
    PNT5b = PNT5.point_at(as_length, lsd, global_dipdir)
    # As simple fault dipping east
    mesh_spacing = 0.5
    simple_fault1 = SimpleFaultSurface.from_fault_data(
        Line([PNT1, PNT2, PNT3, PNT4, PNT5]), usd, lsd, dip, mesh_spacing)
    # As a set of planes describing a concordant "Stirling fault"
    stirling_planes = [
        PlanarSurface.from_corner_points(PNT1, PNT2, PNT2b, PNT1b),
        PlanarSurface.from_corner_points(PNT2, PNT3, PNT3b, PNT2b),
        PlanarSurface.from_corner_points(PNT3, PNT4, PNT4b, PNT3b),
        PlanarSurface.from_corner_points(PNT4, PNT5, PNT5b, PNT4b)
    ]
    stirling_fault1 = MultiSurface(stirling_planes)

    # As a set of planes describing a concordant "Frankel Fault"
    # In the Frankel fault each segment is projected to the local dip direction
    dipdir2b = (dipdir2 + 180.) % 360.0

    frankel_planes = [
        PlanarSurface.from_corner_points(
            PNT1, PNT2, PNT2.point_at(as_length, lsd, dipdir1),
            PNT1.point_at(as_length, lsd, dipdir1)),
        PlanarSurface.from_corner_points(
            PNT2, PNT3, PNT3.point_at(as_length, lsd, dipdir2),
            PNT2.point_at(as_length, lsd, dipdir2)),
        PlanarSurface.from_corner_points(
            PNT3, PNT4, PNT4.point_at(as_length, lsd, dipdir3),
            PNT3.point_at(as_length, lsd, dipdir3)),
        PlanarSurface.from_corner_points(
            PNT4, PNT5, PNT5.point_at(as_length, lsd, dipdir4),
            PNT4.point_at(as_length, lsd, dipdir4))
    ]
    frankel_fault1 = MultiSurface(frankel_planes)

    # Test the case of a discordant Frankel plane
    # Swapping the strike of the second segment to change the dip direction
    # Also increasing the dip from 60 degrees to 75 degrees
    as_length_alt = lsd / numpy.tan(numpy.radians(75.0))
    frankel_discordant = [
        PlanarSurface.from_corner_points(
            PNT1, PNT2, PNT2.point_at(as_length, lsd, dipdir1),
            PNT1.point_at(as_length, lsd, dipdir1)),
        PlanarSurface.from_corner_points(
            PNT3, PNT2, PNT2.point_at(as_length_alt, lsd, dipdir2b),
            PNT3.point_at(as_length_alt, lsd, dipdir2b)),
        PlanarSurface.from_corner_points(
            PNT3, PNT4, PNT4.point_at(as_length, lsd, dipdir3),
            PNT3.point_at(as_length, lsd, dipdir3)),
        PlanarSurface.from_corner_points(
            PNT4, PNT5, PNT5.point_at(as_length, lsd, dipdir4),
            PNT4.point_at(as_length, lsd, dipdir4))
    ]
    frankel_fault2 = MultiSurface(frankel_discordant)
    return simple_fault1, stirling_fault1, frankel_fault1, frankel_fault2
Exemplo n.º 8
0
def _setup_peer_test_bending_fault_config():
    """
    The GC2 tests will be based on variations of the PEER bending fault
    test case:

    (Fault is dipping east north east
    Point 5 (-65.0, 0.0, 0.0)
        o
        |
        |
        |
        o Point 4 (-65.0, -0.16188, 0)
         \
          \
           \
            \
             \
              o Point 3 (-64.90498, -0.36564, 0.0)
               \__
                  \__
                     \__
                        \__
                           \__Point 2 (-64.80164, -0.45236, 0.0)
                              \o---o Point 1 (-64.78365, -0.45236, 0.0)
    """
    # Build separate faults
    # Get down-dip points - dipping east-noth-east
    strike1 = PNT1.azimuth(PNT2)
    dipdir1 = (strike1 + 90.) % 360.0

    strike2 = PNT2.azimuth(PNT3)
    dipdir2 = (strike2 + 90.) % 360.0

    strike3 = PNT3.azimuth(PNT4)
    dipdir3 = (strike3 + 90.) % 360.0

    strike4 = PNT4.azimuth(PNT5)
    dipdir4 = (strike4 + 90.) % 360.0

    global_strike = PNT1.azimuth(PNT5)
    global_dipdir = (global_strike + 90.) % 360.0
    # Get lower trace
    usd = 0.0
    lsd = 12.0
    dip = 60.0
    as_length = lsd / numpy.tan(numpy.radians(dip))
    PNT1b = PNT1.point_at(as_length, lsd, global_dipdir)
    PNT2b = PNT2.point_at(as_length, lsd, global_dipdir)
    PNT3b = PNT3.point_at(as_length, lsd, global_dipdir)
    PNT4b = PNT4.point_at(as_length, lsd, global_dipdir)
    PNT5b = PNT5.point_at(as_length, lsd, global_dipdir)
    # As simple fault dipping east
    mesh_spacing = 0.5
    simple_fault1 = SimpleFaultSurface.from_fault_data(
        Line([PNT1, PNT2, PNT3, PNT4, PNT5]), usd, lsd, dip, mesh_spacing)
    # As a set of planes describing a concordant "Stirling fault"
    stirling_planes = [
        PlanarSurface.from_corner_points(1.0, PNT1, PNT2, PNT2b, PNT1b),
        PlanarSurface.from_corner_points(1.0, PNT2, PNT3, PNT3b, PNT2b),
        PlanarSurface.from_corner_points(1.0, PNT3, PNT4, PNT4b, PNT3b),
        PlanarSurface.from_corner_points(1.0, PNT4, PNT5, PNT5b, PNT4b)
    ]
    stirling_fault1 = MultiSurface(stirling_planes)

    # As a set of planes describing a concordant "Frankel Fault"
    # In the Frankel fault each segment is projected to the local dip direction
    dipdir2b = (dipdir2 + 180.) % 360.0

    frankel_planes = [
        PlanarSurface.from_corner_points(
            1.0, PNT1, PNT2,
            PNT2.point_at(as_length, lsd, dipdir1),
            PNT1.point_at(as_length, lsd, dipdir1)
            ),
        PlanarSurface.from_corner_points(
            1.0, PNT2, PNT3,
            PNT3.point_at(as_length, lsd, dipdir2),
            PNT2.point_at(as_length, lsd, dipdir2)
            ),
        PlanarSurface.from_corner_points(
            1.0, PNT3, PNT4,
            PNT4.point_at(as_length, lsd, dipdir3),
            PNT3.point_at(as_length, lsd, dipdir3)
            ),
        PlanarSurface.from_corner_points(
            1.0, PNT4, PNT5,
            PNT5.point_at(as_length, lsd, dipdir4),
            PNT4.point_at(as_length, lsd, dipdir4)
            )
        ]
    frankel_fault1 = MultiSurface(frankel_planes)

    # Test the case of a discordant Frankel plane
    # Swapping the strike of the second segment to change the dip direction
    # Also increasing the dip from 60 degrees to 75 degrees
    as_length_alt = lsd / numpy.tan(numpy.radians(75.0))
    frankel_discordant = [
        PlanarSurface.from_corner_points(
            1.0, PNT1, PNT2,
            PNT2.point_at(as_length, lsd, dipdir1),
            PNT1.point_at(as_length, lsd, dipdir1)
            ),
        PlanarSurface.from_corner_points(
            1.0, PNT3, PNT2,
            PNT2.point_at(as_length_alt, lsd, dipdir2b),
            PNT3.point_at(as_length_alt, lsd, dipdir2b)
            ),
        PlanarSurface.from_corner_points(
            1.0, PNT3, PNT4,
            PNT4.point_at(as_length, lsd, dipdir3),
            PNT3.point_at(as_length, lsd, dipdir3)
            ),
        PlanarSurface.from_corner_points(
            1.0, PNT4, PNT5,
            PNT5.point_at(as_length, lsd, dipdir4),
            PNT4.point_at(as_length, lsd, dipdir4)
            )
        ]
    frankel_fault2 = MultiSurface(frankel_discordant)
    return simple_fault1, stirling_fault1, frankel_fault1, frankel_fault2
Exemplo n.º 9
0
 def setUp(self):
     """
     Builds a simple dipping/bending fault source with a characteristic
     source model. Compares the curves for four sites, two on the hanging
     wall and two on the footwall.
     The source model is taken from the PEER Tests
     """
     point_order_dipping_east = [
         Point(-64.78365, -0.45236),
         Point(-64.80164, -0.45236),
         Point(-64.90498, -0.36564),
         Point(-65.0000, -0.16188),
         Point(-65.0000, 0.0000)
     ]
     trace_dip_east = Line(point_order_dipping_east)
     site_1 = Site(Point(-64.98651, -0.15738), 760.0, True, 48.0, 0.607)
     site_2 = Site(Point(-64.77466, -0.45686), 760.0, True, 48.0, 0.607)
     site_3 = Site(Point(-64.92747, -0.38363), 760.0, True, 48.0, 0.607)
     site_4 = Site(Point(-65.05396, -0.17088), 760.0, True, 48.0, 0.607)
     self.sites = SiteCollection([site_1, site_2, site_3, site_4])
     self.imtls = {
         "PGA": [
             0.001, 0.01, 0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45,
             0.5, 0.55, 0.6, 0.7, 0.8, 0.9, 1.0
         ]
     }
     fault_surface1 = SimpleFaultSurface.from_fault_data(
         trace_dip_east, 0.0, 12.0, 60., 0.5)
     mfd1 = EvenlyDiscretizedMFD(6.75, 0.01, [0.01])
     tom = PoissonTOM(1.0)
     self.sources = [
         CharacteristicFaultSource(
             "PEER_CHAR_FLT_EAST",
             "Peer Bending Fault Dipping East - Characteristic",
             "Active Shallow Crust", mfd1, tom, fault_surface1, 90.0)
     ]
     # We will check all the GMPEs
     self.gsim_set = {
         "ASK": [
             AbrahamsonEtAl2014NSHMPMean(),
             (0.185, AbrahamsonEtAl2014NSHMPLower()),
             (0.63, AbrahamsonEtAl2014()),
             (0.185, AbrahamsonEtAl2014NSHMPUpper())
         ],
         "BSSA": [
             BooreEtAl2014NSHMPMean(), (0.185, BooreEtAl2014NSHMPLower()),
             (0.63, BooreEtAl2014()), (0.185, BooreEtAl2014NSHMPUpper())
         ],
         "CB": [
             CampbellBozorgnia2014NSHMPMean(),
             (0.185, CampbellBozorgnia2014NSHMPLower()),
             (0.63, CampbellBozorgnia2014()),
             (0.185, CampbellBozorgnia2014NSHMPUpper())
         ],
         "CY": [
             ChiouYoungs2014NSHMPMean(),
             (0.185, ChiouYoungs2014NSHMPLower()),
             (0.63, ChiouYoungs2014()), (0.185, ChiouYoungs2014NSHMPUpper())
         ],
         "ID": [
             Idriss2014NSHMPMean(), (0.185, Idriss2014NSHMPLower()),
             (0.63, Idriss2014()), (0.185, Idriss2014NSHMPUpper())
         ]
     }