shakelib.rupture.edge_rupture

class shakelib.rupture.edge_rupture.EdgeRupture(d, origin, mesh_dx=0.5)[source]

Bases: shakelib.rupture.base.Rupture

Rupture class that representst the rupture surface by specifying the top edge and the bottom edges. These edges do not need to be horizontal. The freedom to allow for non-horizontal edges (as compared to QuadRupture) comes at the cost of slower distance calculations. This is because the rupture must be discretized and then the distances are compued in a brute force fashion based on this mesh, which can be quite large.

Initialization of an EdgeRupture from a GeoJSON dictionary and an Origin.

Parameters:
  • d (dict) – Rupture GeoJSON dictionary.
  • origin (Origin) – Reference to a ShakeMap Origin object.
  • mesh_dx (float) – Target spacing (in km) for rupture discretization; default is 0.5 km and it is only used if the rupture file is an EdgeRupture.
Returns:

EdgeRupture instance.

classmethod fromArrays(toplons, toplats, topdeps, botlons, botlats, botdeps, origin, group_index=None, mesh_dx=0.5, reference='')[source]

Class method to initialize an EdgeRupture class from arrays of longitude, latitude, and depth along the top and bottom edges.

Parameters:
  • toplons (ndarray) – Array of top edge longitudes.
  • toplats (ndarray) – Array of top edge latitudes.
  • topdeps (ndarray) – Array of top edge depths (km).
  • botlons (ndarray) – Array of bot edge longitudes.
  • botlats (ndarray) – Array of bot edge latitudes.
  • botdeps (ndarray) – Array of bot edge depths (km).
  • origin (Origin) – Reference to a ShakeMap Origin object.
  • group_index (ndarray) – Optional array of group index. If None, then assume only single group.
  • mesh_dx (float) – Target spacing (in km) for rupture discretization.
  • reference (str) – Citable reference for rupture.
Returns:

EdgeRupture instance.

getLength()[source]

Compute length of rupture (km). For EdgeRupture, we compute the length as the length of the top edge projected to the surface.

Returns:Rupture length in km.
Return type:float
getWidth()[source]

Compute average rupture width in km. For EdgeRupture, we compute this as the rupture area divided by teh rupture length.

Returns:Rupture width in km.
Return type:float
getArea()[source]

Compute the rupture area. For EdgeRupture, we compute this by grouping the traces into “quadrilaterals” for which the verticies may not be co-planar. We then break up the quadrilaterals into triangles for which we can compute area.

Returns:Rupture area in square km.
Return type:float
getStrike()[source]

Return representative strike for this rupture. Note that strike can vary along the rupture.

Returns:Strike angle in degrees.
Return type:float
getDip()[source]

Representative dip for this rupture. Note that dip can vary along the rupture.

Returns:dip angle in degrees.
Return type:float
lats

Return an array of latitudes for the rupture verticies arranged for plotting purposes; will give an outline of each group connected segments.

Returns:
Numpy array of closed-loop latitude values; disconnected
segments are separated by nans.
Return type:array
lons

Return an array of longitudes for the rupture verticies arranged for plotting purposes; will give an outline of each group connected segments.

Returns:
Numpy array of closed-loop longitude values; disconnected
segments are separated by nans.
Return type:array
depths

Return an array of depths for the rupture verticies arranged for plotting purposes; will give an outline of each group connected segments.

Returns:
Numpy array of closed-loop latitude values; disconnected
segments are separated by nans.
Return type:array
getDepthToTop()[source]
Returns:Depth to top of rupture in km.
Return type:float
getQuadrilaterals()[source]

Return a list of quadrilaterals. Unlike QuadRupture, these quadrilaterals are not restricted to be coplanar or have horizontal top/bottom edges.

Returns:
List of quadrilaterals, where each quadrilateral is
a list of OQ Points.
Return type:list
computeRrup(lon, lat, depth)[source]

Method for computing rupture distance.

Parameters:
  • lon (array) – Numpy array of longitudes.
  • lat (array) – Numpy array of latitudes.
  • depth (array) – Numpy array of depths (km; positive down).
Returns:

Rupture distance (km).

Return type:

array

computeRjb(lon, lat, depth)[source]

Method for computing Joyner-Boore distance.

Parameters:
  • lon (array) – Numpy array of longitudes.
  • lat (array) – Numpy array of latitudes.
  • depth (array) – Numpy array of depths (km; positive down).
Returns:

Joyner-Boore distance (km).

Return type:

array

computeGC2(lon, lat, depth)[source]

Method for computing version 2 of the Generalized Coordinate system (GC2) by Spudich and Chiou OFR 2015-1028.

Parameters:
  • lon (array) – Numpy array of longitudes.
  • lat (array) – Numpy array of latitudes.
  • depth (array) – Numpy array of depths (km; positive down).
Returns:

Dictionary with keys for each of the GC2-related distances,

which include ‘rx’, ‘ry’, ‘ry0’, ‘U’, ‘T’.

Return type:

dict