Esempio n. 1
0
    def iter_ruptures(self, **kwargs):
        """
        See :meth:
        `openquake.hazardlib.source.base.BaseSeismicSource.iter_ruptures`.
        """

        # Set magnitude scaling relationship, temporal occurrence model and
        # mesh of the fault surface
        msr = self.magnitude_scaling_relationship
        tom = self.temporal_occurrence_model
        surface = self.surface

        for mag, mag_occ_rate in self.get_annual_occurrence_rates():

            # Compute the area, length and width of the ruptures
            area = msr.get_median_area(mag=mag, rake=self.rake)
            lng, wdt = get_discrete_dimensions(area, self.rupture_mesh_spacing,
                                               self.rupture_aspect_ratio,
                                               self.profiles_sampling)

            # Get the number of nodes along the strike and dip. Note that
            # len and wdt should be both multiples of the sampling distances
            # used along the strike and width
            rup_len = int(np.round(lng / self.rupture_mesh_spacing)) + 1
            rup_wid = int(np.round(wdt / self.profiles_sampling)) + 1

            # Get the geometry of all the ruptures that the fault surface
            # accommodates
            ruptures = []
            for rup in self._get_ruptures(surface.mesh, rup_len, rup_wid):
                ruptures.append(rup)
            if len(ruptures) < 1:
                continue
            occurrence_rate = mag_occ_rate / len(ruptures)

            # Rupture generator
            for rup in ruptures:
                hypocenter = rup[0].get_center()
                # Yield an instance of a ParametricProbabilisticRupture
                yield ppr(mag, self.rake, self.tectonic_region_type,
                          hypocenter, rup[0], occurrence_rate, tom)
Esempio n. 2
0
    def iter_ruptures(self, **kwargs):
        """
        See :meth:
        `openquake.hazardlib.source.base.BaseSeismicSource.iter_ruptures`.
        """

        # Set magnitude scaling relationship, temporal occurrence model and
        # mesh of the fault surface
        msr = self.magnitude_scaling_relationship
        tom = self.temporal_occurrence_model
        surface = self.surface
        slc = kwargs.get('slc', slice(None))
        for mag, mag_occ_rate in self.get_annual_occurrence_rates():

            # Compute the area, length and width of the ruptures
            area = msr.get_median_area(mag=mag, rake=self.rake)
            lng, wdt = get_discrete_dimensions(area, self.rupture_mesh_spacing,
                                               self.rupture_aspect_ratio,
                                               self.profiles_sampling)

            # Get the number of nodes along the strike and dip. Note that
            # len and wdt should be both multiples of the sampling distances
            # used along the strike and width
            rup_len = int(np.round(lng / self.rupture_mesh_spacing)) + 1
            rup_wid = int(np.round(wdt / self.profiles_sampling)) + 1

            if self.floating_x_step == 0:
                fstrike = 1
            else:
                # ratio = the amount of overlap between consecutive ruptures
                fstrike = int(np.floor(rup_len * self.floating_x_step))
                if fstrike == 0:
                    fstrike = 1

            if self.floating_x_step == 0:
                fdip = 1
            else:
                # as for strike: ratio indicates percentage overlap
                fdip = int(np.floor(rup_wid * self.floating_y_step))
                if fdip == 0:
                    fdip = 1

            # Get the geometry of all the ruptures that the fault surface
            # accommodates
            ruptures = []

            for rup in self._get_ruptures(surface.mesh,
                                          rup_len,
                                          rup_wid,
                                          f_strike=fstrike,
                                          f_dip=fdip):
                ruptures.append(rup)
            if len(ruptures) < 1:
                continue
            occurrence_rate = mag_occ_rate / len(ruptures)

            # Rupture generator
            for rup in ruptures[slc]:
                hypocenter = rup[0].get_center()
                # Yield an instance of a ParametricProbabilisticRupture
                yield ppr(mag, self.rake, self.tectonic_region_type,
                          hypocenter, rup[0], occurrence_rate, tom)