예제 #1
0
    def _expected_char_simple(self):
        tgr_mfd = mfd.TruncatedGRMFD(a_val=-3.5,
                                     b_val=1.0,
                                     min_mag=5.0,
                                     max_mag=6.5,
                                     bin_width=1.0)

        fault_trace = geo.Line(
            [geo.Point(-121.82290, 37.73010),
             geo.Point(-122.03880, 37.87710)])

        surface = geo.SimpleFaultSurface.from_fault_data(
            fault_trace=fault_trace,
            upper_seismogenic_depth=10.0,
            lower_seismogenic_depth=20.0,
            dip=45.0,
            mesh_spacing=MESH_SPACING)

        char = source.CharacteristicFaultSource(
            source_id="5",
            name="characteristic source, simple fault",
            tectonic_region_type="Volcanic",
            mfd=tgr_mfd,
            surface=surface,
            rake=30.0)
        return char
예제 #2
0
    def _expected_char_multi(self):
        tgr_mfd = mfd.TruncatedGRMFD(a_val=-3.6,
                                     b_val=1.0,
                                     min_mag=5.2,
                                     max_mag=6.4,
                                     bin_width=1.0)

        surfaces = [
            geo.PlanarSurface(mesh_spacing=MESH_SPACING,
                              strike=0.0,
                              dip=90.0,
                              top_left=geo.Point(-1, 1, 21),
                              top_right=geo.Point(1, 1, 21),
                              bottom_left=geo.Point(-1, -1, 59),
                              bottom_right=geo.Point(1, -1, 59)),
            geo.PlanarSurface(mesh_spacing=MESH_SPACING,
                              strike=20.0,
                              dip=45.0,
                              top_left=geo.Point(1, 1, 20),
                              top_right=geo.Point(3, 1, 20),
                              bottom_left=geo.Point(1, -1, 80),
                              bottom_right=geo.Point(3, -1, 80))
        ]
        multi_surface = geo.MultiSurface(surfaces)

        char = source.CharacteristicFaultSource(
            source_id="7",
            name="characteristic source, multi surface",
            tectonic_region_type="Volcanic",
            mfd=tgr_mfd,
            surface=multi_surface,
            rake=90.0)
        return char
예제 #3
0
 def _expected_char_multi(self):
     tgr_mfd = mfd.TruncatedGRMFD(
         a_val=-3.6, b_val=1.0, min_mag=5.2, max_mag=6.4, bin_width=1.0)
     surfaces = [
         geo.PlanarSurface(
             strike=89.98254582,
             dip=9.696547068,
             top_left=geo.Point(-1, 1, 21),
             top_right=geo.Point(1, 1, 21),
             bottom_left=geo.Point(-1, -1, 59),
             bottom_right=geo.Point(1, -1, 59)
         ),
         geo.PlanarSurface(
             strike=89.98254582,
             dip=15.0987061388,
             top_left=geo.Point(1, 1, 20),
             top_right=geo.Point(3, 1, 20),
             bottom_left=geo.Point(1, -1, 80),
             bottom_right=geo.Point(3, -1, 80))]
     multi_surface = geo.MultiSurface(surfaces)
     char = source.CharacteristicFaultSource(
         source_id="7",
         name="characteristic source, multi surface",
         tectonic_region_type="Volcanic",
         mfd=tgr_mfd,
         surface=multi_surface,
         rake=90.0,
         temporal_occurrence_model=PoissonTOM(50.0))
     char.num_ruptures = char.count_ruptures()
     return char
예제 #4
0
    def _expected_char_simple(self):
        tgr_mfd = mfd.TruncatedGRMFD(a_val=-3.5,
                                     b_val=1.0,
                                     min_mag=5.0,
                                     max_mag=6.5,
                                     bin_width=1.0)

        fault_trace = geo.Line(
            [geo.Point(-121.82290, 37.73010),
             geo.Point(-122.03880, 37.87710)])

        surface = geo.SimpleFaultSurface.from_fault_data(
            fault_trace=fault_trace,
            upper_seismogenic_depth=10.0,
            lower_seismogenic_depth=20.0,
            dip=45.0,
            mesh_spacing=self.rupture_mesh_spacing)

        char = source.CharacteristicFaultSource(
            source_id="5",
            name="characteristic source, simple fault",
            tectonic_region_type="Volcanic",
            mfd=tgr_mfd,
            surface=surface,
            rake=30.0,
            temporal_occurrence_model=PoissonTOM(50.))
        char.num_ruptures = char.count_ruptures()
        return char
예제 #5
0
    def convert_characteristicFaultSource(self, node):
        """
        Convert the given node into a characteristic fault object.

        :param node: a node with tag areaGeometry
        :returns: a :class:`openquake.hazardlib.source.CharacteristicFaultSource` instance
        """
        char = source.CharacteristicFaultSource(
            source_id=node['id'],
            name=node['name'],
            tectonic_region_type=node['tectonicRegion'],
            mfd=self.convert_mfdist(node),
            surface=self.convert_surfaces(node.surface),
            rake=~node.rake,
            temporal_occurrence_model=self.tom)
        return char
예제 #6
0
    def _expected_char_complex(self):
        incr_mfd = mfd.EvenlyDiscretizedMFD(min_mag=5.0,
                                            bin_width=0.1,
                                            occurrence_rates=[
                                                0.0010614989,
                                                8.8291627E-4,
                                                7.3437777E-4,
                                                6.108288E-4,
                                                5.080653E-4,
                                            ])

        edges = [
            geo.Line([
                geo.Point(-124.704, 40.363, 0.5493260E+01),
                geo.Point(-124.977, 41.214, 0.4988560E+01),
                geo.Point(-125.140, 42.096, 0.4897340E+01),
            ]),
            geo.Line([
                geo.Point(-124.704, 40.363, 0.5593260E+01),
                geo.Point(-124.977, 41.214, 0.5088560E+01),
                geo.Point(-125.140, 42.096, 0.4997340E+01),
            ]),
            geo.Line([
                geo.Point(-124.704, 40.363, 0.5693260E+01),
                geo.Point(-124.977, 41.214, 0.5188560E+01),
                geo.Point(-125.140, 42.096, 0.5097340E+01),
            ]),
            geo.Line([
                geo.Point(-123.829, 40.347, 0.2038490E+02),
                geo.Point(-124.137, 41.218, 0.1741390E+02),
                geo.Point(-124.252, 42.115, 0.1752740E+02),
            ]),
        ]
        complex_surface = geo.ComplexFaultSurface.from_fault_data(
            edges, self.complex_fault_mesh_spacing)

        char = source.CharacteristicFaultSource(
            source_id="6",
            name="characteristic source, complex fault",
            tectonic_region_type="Volcanic",
            mfd=incr_mfd,
            surface=complex_surface,
            rake=60.0,
            temporal_occurrence_model=PoissonTOM(50.0),
        )
        return char
예제 #7
0
def _characteristic_to_hazardlib(src, mesh_spacing, bin_width):
    """
    Convert a NRML characteristic fault source to the HazardLib equivalent.

    The surface of a characteristic fault source can be one of the following:
        * simple fault
        * complex fault
        * one or more planar surfaces

    See :mod:`openquake.nrmllib.models` and :mod:`openquake.hazardlib.source`.

    :param src:
        :class:`openquake.nrmllib.models.CharacteristicSource` instance.
    :param float mesh_spacing:
        Rupture mesh spacing, in km.
    :param float bin_width:
        Truncated Gutenberg-Richter MFD (Magnitude Frequency Distribution) bin
        width.
    :returns:
        The HazardLib representation of the input source.
    """
    mf_dist = _mfd_to_hazardlib(src.mfd, bin_width)

    if isinstance(src.surface, nrml_models.SimpleFaultGeometry):
        shapely_line = wkt.loads(src.surface.wkt)
        fault_trace = geo.Line([geo.Point(*x) for x in shapely_line.coords])

        surface = geo.SimpleFaultSurface.from_fault_data(
            fault_trace, src.surface.upper_seismo_depth,
            src.surface.lower_seismo_depth, src.surface.dip, mesh_spacing)
    elif isinstance(src.surface, nrml_models.ComplexFaultGeometry):
        edges_wkt = []
        edges_wkt.append(src.surface.top_edge_wkt)
        edges_wkt.extend(src.surface.int_edges)
        edges_wkt.append(src.surface.bottom_edge_wkt)

        edges = []

        for edge in edges_wkt:
            shapely_line = wkt.loads(edge)
            line = geo.Line([geo.Point(*x) for x in shapely_line.coords])
            edges.append(line)

        surface = geo.ComplexFaultSurface.from_fault_data(edges, mesh_spacing)
    else:
        # A collection of planar surfaces
        planar_surfaces = []
        for planar_surface in src.surface:
            kwargs = planar_surface.__dict__
            kwargs.update(dict(mesh_spacing=mesh_spacing))

            planar_surfaces.append(geo.PlanarSurface(**kwargs))

        surface = geo.MultiSurface(planar_surfaces)

    char = source.CharacteristicFaultSource(source_id=src.id,
                                            name=src.name,
                                            tectonic_region_type=src.trt,
                                            mfd=mf_dist,
                                            surface=surface,
                                            rake=src.rake)
    return char