Пример #1
0
    def get_rupture_enclosing_polygon(self, dilation=0):
        """
        Create instance of
        :class:`openquake.hazardlib.geo.surface.multi.MultiSurface` from all
        ruptures' surfaces and compute its bounding box. Calculate convex hull
        of bounding box, and return it dilated by ``dilation``.

        :param dilation:
            A buffer distance in km to extend the polygon borders to.
        :returns:
            Instance of :class:`openquake.hazardlib.geo.polygon.Polygon`.
        """
        surfaces = []
        for rup, _ in self.data:
            if isinstance(rup.surface, MultiSurface):
                for s in rup.surface.surfaces:
                    surfaces.append(s)
            else:
                surfaces.append(rup.surface)
        multi_surf = MultiSurface(surfaces)

        west, east, north, south = multi_surf.get_bounding_box()
        mesh = RectangularMesh(numpy.array([[west, east], [west, east]]),
                               numpy.array([[north, north], [south, south]]),
                               None)
        poly = mesh.get_convex_hull()

        return poly if dilation == 0 else poly.dilate(dilation)
Пример #2
0
    def get_rupture_enclosing_polygon(self, dilation=0):
        """
        Uses :meth:
        `openquake.hazardlib.geo.surface.base.BaseSurface.get_bounding_box()`
        and from bounding box coordinates create
        :class:`openquake.hazardlib.geo.mesh.RectangularMesh` and then calls
        :meth:`openquake.hazardlib.geo.mesh.Mesh.get_convex_hull()` to get a
        polygon representation of the bounding box. Note that this is needed
        to cope with the situation of a vertical rupture for which the bounding
        box collapses to a line. In this case the method ``get_convex_hull()``
        returns a valid polygon obtained by expanding the line by a small
        distance. Finally, a polygon is returned by calling
        :meth:`~openquake.hazardlib.geo.polygon.Polygon.dilate` passing in the
        ``dilation`` parameter.

        See :meth:`superclass method
        <openquake.hazardlib.source.base.BaseSeismicSource.get_rupture_enclosing_polygon>`
        for parameter and return value definition.
        """
        west, east, north, south = self.surface.get_bounding_box()
        mesh = RectangularMesh(numpy.array([[west, east], [west, east]]),
                               numpy.array([[north, north], [south, south]]),
                               None)
        poly = mesh.get_convex_hull()

        return poly.dilate(dilation)
Пример #3
0
    def get_rupture_enclosing_polygon(self, dilation=0):
        """
        Uses :meth:
        `openquake.hazardlib.geo.surface.base.BaseSurface.get_bounding_box()`
        and from bounding box coordinates create
        :class:`openquake.hazardlib.geo.mesh.RectangularMesh` and then calls
        :meth:`openquake.hazardlib.geo.mesh.Mesh.get_convex_hull()` to get a
        polygon representation of the bounding box. Note that this is needed
        to cope with the situation of a vertical rupture for which the bounding
        box collapses to a line. In this case the method ``get_convex_hull()``
        returns a valid polygon obtained by expanding the line by a small
        distance. Finally, a polygon is returned by calling
        :meth:`~openquake.hazardlib.geo.polygon.Polygon.dilate` passing in the
        ``dilation`` parameter.

        See :meth:`superclass method
        <openquake.hazardlib.source.base.BaseSeismicSource.get_rupture_enclosing_polygon>`
        for parameter and return value definition.
        """
        west, east, north, south = self.surface.get_bounding_box()
        mesh = RectangularMesh(numpy.array([[west, east], [west, east]]),
                               numpy.array([[north, north], [south, south]]),
                               None)
        poly = mesh.get_convex_hull()

        return poly.dilate(dilation)
Пример #4
0
    def get_rupture_enclosing_polygon(self, dilation=0):
        """
        Create instance of
        :class:`openquake.hazardlib.geo.surface.multi.MultiSurface` from all
        ruptures' surfaces and compute its bounding box. Calculate convex hull
        of bounding box, and return it dilated by ``dilation``.

        :param dilation:
            A buffer distance in km to extend the polygon borders to.
        :returns:
            Instance of :class:`openquake.hazardlib.geo.polygon.Polygon`.
        """
        surfaces = [rup.surface for (rup, _) in self.data]
        multi_surf = MultiSurface(surfaces)

        west, east, north, south = multi_surf.get_bounding_box()
        mesh = RectangularMesh(numpy.array([[west, east], [west, east]]),
                               numpy.array([[north, north], [south, south]]),
                               None)
        poly = mesh.get_convex_hull()

        return poly if dilation == 0 else poly.dilate(dilation)