shakelib.rupture.base

class shakelib.rupture.base.Rupture[source]

Bases: abc.ABC

Abstract base class for ruptures.

Note on terminology:

  • There are three Ruptuer subclasses: PointRupture, QuadRupture, and EdgeRupture.
  • PointRupture represents the rupture as a point source.
  • QuadRupture and EdgeRupture are two different finite source representations.
  • A finite rupture is composed of segments. For QuadRupture, a segment is a quadrilaterial; for an EdgeRupture, a segment is a line connecting two points.
  • Segments are grouped with a common “group index”.
  • Segments within a group must be continuous.
  • The QuadRupture class requires that each segment is a quadrilateral with horizontal top and obttom edges.
  • The EdgeRupture class allows for arbitrarily complex top and bottom edge specification.
writeGeoJson(file)[source]

Write the rupture to a GeoJson file.

Parameters:file (str) – Name of file.
getLength()[source]
Returns:Rupture length in km.
Return type:float
getWidth()[source]
Returns:Rupture width in km.
Return type:float
getArea()[source]
Returns:Rupture area in square km.
Return type:float
getStrike()[source]

Return strike angle. If rupture consists of multiple quadrilaterals, the average strike angle, weighted by quad length, is returned. Note: for ruptures with quads where the strike angle changes by 180 deg due to reverses in dip direction are problematic and not handeled well by this algorithm.

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

Method to return rupture quadrilaterals. Returns None for PointRupture.

getReference()[source]
Returns:Reference info from file.
Return type:string
getOrigin()[source]
Returns:Origin object
lats
lons
depths
getRuptureContext(gmpelist)[source]

Returns an Openquake RuptureContext.

Parameters:gmpelist (list) – List of hazardlib GMPE objects.
Returns:RuptureContext object with all known parameters filled in.
computeRhyp(lon, lat, depth)[source]

Method for computing hypocentral distance.

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

Hypocentral distance (km).

Return type:

array

computeRepi(lon, lat, depth)[source]

Method for computing epicentral distance.

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

Epicentral 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

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

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

plot3d()[source]

Method for making a quick 3D wireframe plot of rupture.

map()[source]

Method for making a quick map of the fault.