EDKSmp Tools

A bunch of routines to handle EDKS

Written by F. Ortega in 2010. Modified by R. Jolivet in 2014. Modified by R. Jolivet in 2017 (multiprocessing added for point dropping)

csi.EDKSmp.dropSourcesInPatches(fault, verbose=False, returnSplittedPatches=False)

From a fault object, returns sources to be given to sum_layered_sub. The number of sources is determined by the spacing provided in fault.

Args:
  • fault : instance of Fault (Rectangular or Triangular).

  • verbose : Talk to me

  • returnSplittedPactchesReturns a triangularPatches object with the splitted

    patches.

Return:
  • Ids : Id of the subpatches

  • Xs : UTM x-coordinate of the subpatches (km)

  • Ys : UTM y-coordinate of the subpatches (km)

  • Zs : UTM z-coordinate of the subpatches (km)

  • Strikes : Strike angles of the subpatches (rad)

  • Dips : Dip angles of the subpatches (rad)

  • Areas : Area of the subpatches (km^2)

if returnSplittedPatches: * splitFault : Fault object with the subpatches

class csi.EDKSmp.interpolateEDKS(kernel, verbose=True)

A class that will interpolate the EDKS Kernels and produce Green’s functions in a stratified medium. This class will only use point sources as the summation is done in the fault object.

What goes in this class is a translation of the point source case of EDKS. We use the case where slip perpendicular to the rake angle is equal to zero.

Args:
  • kernelEDKS Kernel file (mykernel.edks). One needs to

    provide the header file as well (hdr.mykernel.edks)

createInterpolator(method='linear')

Create the interpolation method. This is based on scipy.interpolate.LinearNDInterpolator.

Returns:
  • None

interpolate(xs, ys, zs, strike, dip, rake, area, slip, xr, yr, method='linear')

Interpolate the Green’s functions for a given source in (xs, ys, zs) with a strike, dip and rake and slip parameters and a given receiver (xr, yr)

Args:
  • xs, ys, zs : Source location (floats or np.array)

  • strike : strike angle (rad)

  • dip : dip angle (rad)

  • rake : rake angle (rad, 0 left-lateral strike slip, 2pi pure thrust)

  • slip : Slip value. The unit of slip will condition the unit of the output displacement

  • area : Area of the point source

  • xr, yr : Receiver location (floats or np.array)

Kwargs:
  • method : Interpolation scheme. Can be linear, nearest or CloughTocher.

Returns:
  • G : np.array

readHeader()

Read the EDKS Kernel header file and stores it in {self}

Returns:
  • None

readKernel()

Read the EDKS Kernel and stores it in {self}

Returns:
  • None

src2mom(slip, area, strike, dip, rake)

Convert slip and point source geometry to moment.

Args:
  • slip : Slip value (m).

  • area : Area of the point source (m^2)

  • strike : Strike angle (rad)

  • dip : Dip angle (rad)

  • rake : Rake angle (rad, 0 left-lateral strike slip, 2pi pure thrust)

Returns:
  • M : Moment tensor

class csi.EDKSmp.interpolator(interpolators, queue, depths, distas, istart, iend)

Multiprocessing class runing the edks interpolation. This class requires one to build the interpolator in advance.

Args:
  • interpolators : List of interpolators

  • queue : Instance of mp.Queue

  • depths : depths (first dimnesion of the interpolators)

  • distas : distances (second dimension of the interpolators)

  • istart : starting point

  • iend : ending point

Returns:
  • None

run()

Run the interpolation

class csi.EDKSmp.pointdropper(fault, queue, charArea, istart, iend)

Initialize the multiprocessing class to run the point dropper. This class drops point sources in the triangular or rectangular mesh.

Args:
  • fault : Instance of Fault.py

  • queue : Instance of mp.Queue

  • charArea : Characteristic area of the subfaults

  • istart : Index of the first patch to deal with

  • iend : Index of the last pacth to deal with

Returns:
  • None

run()

Run the subpatch construction

csi.EDKSmp.sum_layered(xs, ys, zs, strike, dip, rake, slip, width, length, npw, npy, xr, yr, edks, prefix, BIN_EDKS='EDKS_BIN', cleanUp=True, verbose=True)

Compute the Green’s functions for the given patches

Args:

<– Sources –> 1-D numpy arrays

  • xs : m, east coord to center of fault patch

  • ys : m, north coord to center of fault patch

  • zs : m,depth coord to center of fault patch (+ down)

  • strike : deg, clockwise from north

  • dip : deg, 90 is vertical

  • rake : deg, 0 left lateral strike slip, 90 up-dip slip

  • slip : m, slip in the rake direction

  • width : m, width of the patch

  • length : m, length of the patch

  • npw : integers, number of sources along strike

  • npy : integers, number of sources along dip

<– Receivers –> 1-D numpy arrays

  • xr : m, east coordinate of receivers

  • yr : m, north coordinate of receivers

<– Elastic structure –>

  • edks : string, full name of edks file, e.g., halfspace.edks

<– File Naming –>

  • prefix : string, prefix for the files generated by sum_layered

Kwargs:

  • BIN_EDKS : Environement variable where EDKS executables are.

  • cleanUp : Remove the intermediate files

  • verbose : Talk to me

Return:
<– 2D arrays (#receivers, #fault patches) –>
  • ux : m, east displacement

  • uy : m, west displacement

  • uz : m, up displacement (+ up)