Esempio n. 1
0
    def iter_ruptures(self, temporal_occurrence_model):
        """
        See :meth:`nhlib.source.base.SeismicSource.iter_ruptures`.

        Uses :func:`_float_ruptures` for finding possible rupture locations
        on the whole fault surface.
        """
        whole_fault_surface = ComplexFaultSurface.from_fault_data(
            self.edges, self.rupture_mesh_spacing)
        whole_fault_mesh = whole_fault_surface.get_mesh()
        cell_center, cell_length, cell_width, cell_area = (
            whole_fault_mesh.get_cell_dimensions())

        for (mag, mag_occ_rate) in self.get_annual_occurrence_rates():
            rupture_area = self.magnitude_scaling_relationship.get_median_area(
                mag, self.rake)
            rupture_length = numpy.sqrt(rupture_area *
                                        self.rupture_aspect_ratio)
            rupture_slices = _float_ruptures(rupture_area, rupture_length,
                                             cell_area, cell_length)
            occurrence_rate = mag_occ_rate / float(len(rupture_slices))

            for rupture_slice in rupture_slices:
                mesh = whole_fault_mesh[rupture_slice]
                # XXX: use surface centroid as rupture's hypocenter
                # XXX: instead of point with middle index
                hypocenter = mesh.get_middle_point()
                surface = ComplexFaultSurface(mesh)
                yield ProbabilisticRupture(mag, self.rake,
                                           self.tectonic_region_type,
                                           hypocenter, surface, type(self),
                                           occurrence_rate,
                                           temporal_occurrence_model)