5. slipsurface

Module for defining the classes related to the slip surface, either a circular or a composite geometry (e.g. a tortuous failure surface)

class slipsurface.CircularSurface(slopeCoords, dist1, dist2, radius, concave=True)[source]

Bases: object

Creates an instance of an object that defines the structure of an polyline which represents the slip surface of a landslide which geometry is a circumference-arc.

CircularSurface(slopeCoords, dist1, dist2, radius, concave=True)

The arc is defined with two points on the terrain surface and the radius. That implies there are two possible solutions; to select which one is wanted, it is necessary to modify the variable concave.

It is possible the arc cuts across the terrain surface in some point different to its ends, perhaps because of some swedge in the terrrain or the radius is too long. In that case, the method defineStructre changes the attribute dist2 such that it is replaced by the horizontal distance of the intersection point.

slopeCoords

Coordinates of the vertices of the polygon within which the slope mass is defined. It is obtained with the method defineboundary either from the classes AnthropicSlope or NaturalSlope (module slope).

Type:(2, n numpy.ndarray
dist1

First horizontal distance from the leftmost point of the terrain surface (including the crown) where the arc is intersected with it.

Type:int or float
dist2

Second horizontal distance from the leftmost point of the terrain surface (including the crown) where the arc is intersected with it.

Type:int or float
radius

Length of the circumference-arc radius.

Type:int or float
concave

Logical variable to define if it is wanted that the circumference-arc will be concave (upwards), otherwise, it will be convexe (downwards). Default value is True.

Type:bool

Note

The class CircularSurface requires numpy, matplotlib and shapely.

Examples

>>> from numpy import array
>>> from pybimstab.slope import AnthropicSlope
>>> from pybimstab.slipsurface import CircularSurface
>>> slope = AnthropicSlope(slopeHeight=7.5, slopeDip=[1, 1.5],
>>>                        crownDist=5, toeDist=5)
>>> surface = CircularSurface(slopeCoords=slope.coords,
>>>                           dist1=2, dist2=10, radius=9)
>>> surface.__dict__.keys()
dict_keys(['slopeCoords', 'dist1', 'dist2', 'radius', 'concave',
           'point1', 'point2', 'center', 'initAngle',
           'endAngle', 'coords'])
defineStructre()[source]

Method to define the structure of the circumference-arc which represents the slip surface of a landslide.

If the arc cuts across the terrain surface in some point different to its ends, the attribute dist2 is modified to the horizontal distance of the intersection point.

The returned angles have values betwen :math: left[pi, -pi right), where the angle equal to zero coincides with the vector :math: left(1, 0) right).

Returns:dictionary with the following outputs.
  • center (tuple): Coordinates of the circumference-arc center
  • endAngle (float): Angle in radians of the vector that points from the center to the first intersection between the terrain surface and the circumference-arc.
  • initAngle (float): Angle in radians of the vector that points from the center to the first intersection between the terrain surface and the circumference-arc.
  • point1 (tuple): Coordinates of the first point that intersects the terrain surface
  • point2 (tuple): Coordinates of the second point that intersects the terrain surface
Return type:(dict)

Examples

>>> from numpy import array
>>> from pybimstab.slope import AnthropicSlope
>>> from pybimstab.slipsurface import CircularSurface
>>> slope = AnthropicSlope(slopeHeight=7.5, slopeDip=[1, 1.5],
>>>                        crownDist=5, toeDist=5)
>>> surface = CircularSurface(slopeCoords=slope.coords,
>>>                           dist1=2, dist2=10, radius=9)
>>> surface.defineStructre()
{'center': (10.881322862689261, 10.831744386868543),
 'endAngle': -1.668878272858519,
 'initAngle': -2.979016942655663,
 'point1': array([2.   , 9.375]),
 'point2': array([10.   ,  1.875])}
>>> from numpy import array
>>> from pybimstab.slope import AnthropicSlope
>>> from pybimstab.slipsurface import CircularSurface
>>> slope = AnthropicSlope(slopeHeight=7.5, slopeDip=[1, 1.5],
>>>                        crownDist=5, toeDist=5)
>>> surface = CircularSurface(slopeCoords=slope.coords,
>>>                           dist1=2, dist2=10, radius=1)
>>> surface.defineStructre()
ValueError: separation of points > diameter
>>> from numpy import array
>>> from pybimstab.slope import AnthropicSlope
>>> from pybimstab.slipsurface import CircularSurface
>>> slope = AnthropicSlope(slopeHeight=7.5, slopeDip=[1, 1.5],
>>>                        crownDist=5, toeDist=5)
>>> surface = CircularSurface(slopeCoords=slope.coords,
>>>                           dist1=2, dist2=10, radius=6)
>>> surface.defineStructre()
ValueError: Radius too short. Increase at least 1.516
plot()[source]

Method for generating a graphic of the circumference-arc and the slope.

Returns:object with the matplotlib structure of the plot. You might use it to save the figure for example.
Return type:(matplotlib.figure.Figure)

Examples

>>> from numpy import array
>>> from pybimstab.slope import AnthropicSlope
>>> from pybimstab.slipsurface import CircularSurface
>>> slope = AnthropicSlope(slopeHeight=7.5, slopeDip=[1, 1.5],
>>>                        crownDist=5, toeDist=5)
>>> surface = CircularSurface(slopeCoords=slope.coords,
>>>                           dist1=2, dist2=10, radius=9)
>>> fig = surface.plot()
slipsurface_CircularSurface_example1

example script.

>>> from numpy import array
>>> from pybimstab.slope import NaturalSlope
>>> from pybimstab.slipsurface import CircularSurface
>>> terrainCoords = array(
>>>     [[-2.49, 0.1 , 1.7 , 3.89, 5.9 , 8.12, 9.87, 13.29, 20.29,
>>>       21.43, 22.28, 23.48, 24.65, 25.17],
>>>      [18.16, 17.88, 17.28, 15.73, 14.31, 13.58, 13, 3.61, 3.61,
>>>       3.32, 2.71, 2.23, 1.21, 0.25]])
>>> slope = NaturalSlope(terrainCoords)
>>> surface = CircularSurface(slopeCoords=slope.coords,
>>>                           dist1=7, dist2=20, radius=13)
>>> fig = surface.plot()
slipsurface_CircularSurface_example2

example script.

class slipsurface.TortuousSurface(bim, dist1, dist2, heuristic='manhattan', reverseLeft=False, reverseUp=False, smoothFactor=0, preferredPath=None, prefPathFact=None)[source]

Bases: object

Creates an instance of an object that defines the structure of an polyline which represents the slip surface of a landslide which geometry is a tortuous path surrouding the blocks inside the slope mass.

TortuousSurface(bim, dist1, dist2, heuristic='Manhattan',
                reverseLeft=False, reverseUp=False, smoothFactor=0,
                preferredPath=None, prefPathFact=None)

The surface is defined with two points on the terrain surface and the heuristic function. It is possible to set a forced path to modify the free trajectory of the tortuous path with the aim of move it closer to, for example a circular surface.

bim

object with the structure of the slope made of the Blocks-In-Matrix material.

Type:BlocksInMatrix object
dist1

First horizontal distance from the leftmost point of the terrain surface (including the crown) where the arc is intersected with it.

Type:int or float
dist2

Second horizontal distance from the leftmost point of the terrain surface (including the crown) where the arc is intersected with it.

Type:int or float
heuristic

Name of the geometric model to determine the heuristic distance. It must be selected either Manhattan or Euclidean; their description can be found in the Astar class documentation. Manhattan is the default value.

Type:str
reverseLeft

Logical variable to allow or not reverses movements to the left. Default value is False.

Type:bool
reverseUp

Logical variable to allow or not reverses movements to upward. Default value is False.

Type:bool
smoothFactor

Value to indicate the B-spline interpolation order of the smooter function. If is equal to zero, which is the default value, the surface will not be smoothed.

Type:int
preferredPath

(2, n) array with the coordinates of a path where the tortuous surface is going to be forced; None is the default value.

Type:numpy.ndarray or None
prefPathFact

Multiplier of the shortest distance between the current point and the polyline; None is the default value.

Type:int or float or None

Note

The class TortuousSurface requires numpy, matplotlib and shapely.

Examples

>>> from pybimstab.slope import AnthropicSlope
>>> from pybimstab.bim import BlocksInMatrix
>>> from pybimstab.slipsurface import TortuousSurface
>>> slope = AnthropicSlope(slopeHeight=12, slopeDip=[1, 1.5],
>>>                        crownDist=10, toeDist=10)
>>> bim = BlocksInMatrix(slopeCoords=slope.coords, blockProp=0.25,
>>>                      tileSize=0.25, seed=123)
>>> surface = TortuousSurface(
>>>     bim, dist1=0, dist2=17, heuristic='manhattan',
>>>     reverseLeft=False, reverseUp=False, smoothFactor=0,
>>>     preferredPath=None, prefPathFact=None)
>>> surface.__dict__.keys()
dict_keys(['bim', 'dist1', 'dist2', 'heuristic', 'reverseLeft',
           'reverseUp', 'smoothFactor', 'preferredPath',
           'prefPathFact', 'terrainSurfLS', 'point1', 'end1', 'point2',
           'end2', 'startIdx', 'goalIdx', 'coords'])
getIndexes(coord)[source]

Method for obtaining the array indexes of the BIM structure for a coordinate given in the real scale of the slope stability problem.

The transformation is performed by rounding the division between the coordinate and the tile size with the int_ function of numpy. That means that always rounds to the left and bottom sides of a tile.

coord

Coordinates of some point in the slope mass or surface, which is wanted to get them indexes into the BIM grid-grapth structure.

Type:tuple
Returns:Indexes of a coordinate from the real-scale problem projected to the array that represents the BIM structure of the slope; the first value of the tuple is the row and the second one is the column of the grid-array respectively.
Return type:(tuple)

Examples

>>> from pybimstab.slope import AnthropicSlope
>>> from pybimstab.bim import BlocksInMatrix
>>> from pybimstab.slipsurface import TortuousSurface
>>> slope = AnthropicSlope(slopeHeight=12, slopeDip=[1, 1.5],
>>>                        crownDist=10, toeDist=10)
>>> bim = BlocksInMatrix(slopeCoords=slope.coords, blockProp=0.25,
>>>                      tileSize=0.25, seed=123)
>>> surface = TortuousSurface(bim, dist1=0, dist2=17)
>>> surface.getIndexes(surface.point1)
(66, 00)
>>> surface.getIndexes(surface.point2)
(24, 68)
getCoord(indexes)[source]

Method for obtaining the real scale problem coordinates of of some cell in the BIM grid-graph structure of the slope.

The transformation is performed by getting the center of the tile which contains the coordinates of the point.

indexes

Indexes of some cell in the BIM grid-graph structure of the slope; the first tuple-value is the ordinate and the second one is the abscisse.

Type:tuple
Returns:Indexes of a coordinate from the real-scale problem projected to the array that represents the BIM structure of the slope; the first tuple value is the abscisse and the second one is the ordinate.
Return type:(tuple)

Examples

>>> from pybimstab.slope import AnthropicSlope
>>> from pybimstab.bim import BlocksInMatrix
>>> from pybimstab.slipsurface import TortuousSurface
>>> slope = AnthropicSlope(slopeHeight=12, slopeDip=[1, 1.5],
>>>                        crownDist=10, toeDist=10)
>>> bim = BlocksInMatrix(slopeCoords=slope.coords, blockProp=0.25,
>>>                      tileSize=0.25, seed=123)
>>> surface = TortuousSurface(bim, dist1=0, dist2=17)
>>> surface.getCoord((66, 0))
(0.125, 16.446428571428573)
>>> surface.getCoord((24, 68))
(17.125, 5.946428571428573)
getIndexesAtEnds()[source]

Method for obtaining the array indexes of the BIM grid-grapth structure for the ends of the slip surface.

Examples

>>> from pybimstab.slope import AnthropicSlope
>>> from pybimstab.bim import BlocksInMatrix
>>> from pybimstab.slipsurface import TortuousSurface
>>> slope = AnthropicSlope(slopeHeight=12, slopeDip=[1, 1.5],
>>>                        crownDist=10, toeDist=10)
>>> bim = BlocksInMatrix(slopeCoords=slope.coords, blockProp=0.25,
>>>                      tileSize=0.25, seed=123)
>>> surface = TortuousSurface(bim, dist1=0, dist2=17)
>>> surface.getIndexesAtEnds()
((66, 0), (23, 68))
defineStructre()[source]

Method to define the structure of the tortuous path which represents the slip surface of a landslide that occurs in a slope made of BIM.

The surface is generated through the \(\mathrm{A}^\ast\) algorithm defined in the Astar module.

Examples

>>> from pybimstab.slope import AnthropicSlope
>>> from pybimstab.bim import BlocksInMatrix
>>> from pybimstab.slipsurface import TortuousSurface
>>> slope = AnthropicSlope(slopeHeight=12, slopeDip=[1, 1.5],
>>>                        crownDist=10, toeDist=10)
>>> bim = BlocksInMatrix(slopeCoords=slope.coords, blockProp=0.25,
>>>                      tileSize=0.25, seed=123)
>>> surface = TortuousSurface(bim, dist1=0, dist2=17)
>>> surface.defineStructre()
array([[ 0.        ,  0.125     ,  0.375     ,  0.625     , ... ],
       [16.57142857, 16.44642857, 16.19642857, 15.94642857, ... ]])
plot()[source]

Method for generating a graphic of the tortuous slip surface and the slope.

Returns:object with the matplotlib structure of the plot. You might use it to save the figure for example.
Return type:(matplotlib.figure.Figure)

Examples

>>> from pybimstab.slope import AnthropicSlope
>>> from pybimstab.bim import BlocksInMatrix
>>> from pybimstab.slipsurface import TortuousSurface
>>> slope = AnthropicSlope(slopeHeight=12, slopeDip=[1, 1.5],
>>>                        crownDist=10, toeDist=10)
>>> bim = BlocksInMatrix(slopeCoords=slope.coords, blockProp=0.25,
>>>                      tileSize=0.25, seed=123)
>>> # Not allowing to turn left and up
>>> surface = TortuousSurface(
>>>     bim, dist1=0, dist2=17, heuristic='manhattan',
>>>     reverseLeft=False, reverseUp=False, smoothFactor=0,
>>>     preferredPath=None, prefPathFact=None)
>>> fig = surface.plot()
slipsurface_TortuousSurface_example1

example script.

>>> # Allowing to turn left and up (manhattan heusitic function)
>>> surface = TortuousSurface(
>>>     bim, dist1=0, dist2=17, heuristic='manhattan',
>>>     reverseLeft=True, reverseUp=True, smoothFactor=0,
>>>     preferredPath=None, prefPathFact=None)
>>> fig = surface.plot()
slipsurface_TortuousSurface_example2

example script.

>>> from numpy import array
>>> from pybimstab.slope import NaturalSlope
>>> from pybimstab.bim import BlocksInMatrix
>>> from pybimstab.slipsurface import CircularSurface, TortuousSurface
>>> terrainCoords = array(
>>>     [[-2.49, 0.1, 1.7, 3.89, 5.9, 8.12, 9.87, 13.29, 20.29,
>>>       21.43, 22.28, 23.48, 24.65, 25.17],
>>>      [18.16, 17.88, 17.28, 15.73, 14.31, 13.58, 13, 3.61, 3.61,
>>>       3.32, 2.71, 2.23, 1.21, 0.25]])
>>> slope = NaturalSlope(terrainCoords)
>>> bim = BlocksInMatrix(slopeCoords=slope.coords, blockProp=0.3,
>>>                      tileSize=0.35, seed=123)
>>> preferredPath = CircularSurface(
>>>     slopeCoords=slope.coords, dist1=5, dist2=15.78, radius=20)
>>> # With a preferred path and smoothing the surface
>>> surface = TortuousSurface(
>>>     bim, dist1=4, dist2=15.78, heuristic='euclidean',
>>>     reverseLeft=False, reverseUp=False, smoothFactor=2,
>>>     preferredPath=preferredPath.coords, prefPathFact=2)
>>> fig = surface.plot()
slipsurface_TortuousSurface_example3

example script.

>>> # Without a preferred path and smoothing the surface
>>> surface = TortuousSurface(
>>>     bim, dist1=5, dist2=15.78, heuristic='euclidean',
>>>     reverseLeft=False, reverseUp=False, smoothFactor=2,
>>>     preferredPath=None)
>>> fig = surface.plot()
slipsurface_TortuousSurface_example4

example script.