srcmodsolution class

class csi.srcmodsolution(name, utmzone=None, lon0=None, lat0=None, ellps='WGS84', verbose=True)
BuildPatches()

Build patches from the FSP/SLP description

Flat23D(x, y)

From a line in the fault plane referential, returns the 3d x, y, z coordinates of that line.

Patch2Trace()

Builds a fake trace from the patches. @todo plot only the shallowest fault trace

addfaults(filename)

Add some other faults to plot with the modeled one.

Args:
  • filename : Name of the fault file (GMT lon lat format).

addpatch(patch, slip=[0, 0, 0])

Adds a patch to the list. Args:

  • patch : Geometry of the patch to add

  • slip : List of the strike, dip and tensile slip.

assembleCd(datas)

Assembles the data covariance matrixes that have been built by each data structure.

assembleGFs(datas, polys=0, slipdir='sd')

Assemble the Green’s functions that have been built using build GFs. This routine spits out the General G and the corresponding data vector d. Args:

  • datas : data sets to use as inputs (from gps and insar).

  • polys0 -> nothing additional is estimated

    1 -> estimate a constant offset 3 -> estimate z = ax + by + c 4 -> estimate z = axy + bx + cy + d ‘full’ -> Only for GPS, estimates a rotation, translation and scaling with

    respect to the center of the network (Helmert transform).

  • slipdir : which directions of slip to include. can be any combination of s, d and t.

assembled(datas)

Assembles the data vector corresponding to the stored green’s functions. Args:

  • datas : list of the data object involved (from gps and insar).

buildCm(sigma, lam, lam0=None, extra_params=None, lim=None)

Builds a model covariance matrix using the equation described in Radiguet et al 2010. Args:

  • sigma : Amplitude of the correlation.

  • lam : Characteristic length scale.

  • lam0 : Normalizing distance (if None, lam0=min(distance between patches)).

  • extra_params : Add some extra values on the diagonal.

  • lim : Limit distance parameter (see self.distancePatchToPatch)

buildGFs(data, vertical=True, slipdir='sd')

Builds the Green’s function matrix based on the discretized fault. Args:

  • data : data object from gps or insar.

  • vertical : if True, will produce green’s functions for the vertical displacements in a gps object.

  • slipdir : direction of the slip along the patches. can be any combination of s (strikeslip), d (dipslip) and t (tensile).

The Green’s function matrix is stored in a dictionary. Each entry of the dictionary is named after the corresponding dataset. Each of these entry is a dictionary that contains ‘strikeslip’, ‘dipslip’ and/or ‘tensile’.

computeSlipContour(value=2.0)

Computes the slip contour for one value only.

computeSlipDirection(scale=1.0, factor=1.0)

Computes the segment indicating the slip direction. scale can be a real number or a string in ‘total’, ‘strikeslip’, ‘dipslip’ or ‘tensile’

computetotalslip()

Computes the total slip.

deletepatch(patch)

Deletes a patch. Args:

  • patch : index of the patch to remove.

deletepatches(tutu)

Deletes a list of patches.

distancePatchToPatch(patch1, patch2, distance='center', lim=None)

Measures the distance between two patches. Args:

  • patch1 : geometry of the first patch.

  • patch2 : geometry of the second patch.

  • distancedistance estimation mode

    center : distance between the centers of the patches. no other method is implemented for now.

  • lim : if not None, list of two float, the first one is the distance above which d=lim[1].

duplicateFault()

Returns a copy of the fault.

file2trace(filename)

Reads the fault trace directly from a file. Format is: Lon Lat

Args:
  • filename : Name of the fault file.

getHelmertMatrix(data)

Returns a Helmert matrix for a gps data set.

getcenter(p)

Get the center of one patch. Args:

  • p : Patch geometry.

getcenters()

Get the center of the patches.

getpatchgeometry(patch, center=False)

Returns the patch geometry as needed for okada85. Args:

  • patch : index of the wanted patch or patch;

  • center : if true, returns the coordinates of the center of the patch. if False, returns the UL corner.

getslip(p)

Returns the slip vector for a patch.

initializeslip(n=None)

Re-initializes the fault slip array. Args:

  • n : Number of slip values. If None, it’ll take the number of patches.

mergePatches(p1, p2)

Merges 2 patches that have common corners. Args:

  • p1 : index of the patch #1.

  • p2 : index of the patch #2.

plot(ref='utm', figure=134, add=False, maxdepth=None, show=True)

Plot the available elements of the fault.

Args:
  • ref : Referential for the plot (‘utm’ or ‘lonlat’).

  • figure : Number of the figure.

readFSP(filename)

Reads the fault geometry from a FSP file that has only one segment (will implement the multisegment later ‘cause it is a pain in the ***)

readInput(filename)

Reads both the fsp and slp files.

readSLP(filename)

Reads the slip distribution and the geometry from a .slp file (SRCMOD format). Args:

  • filename : Input file name.

saveGFs(dtype='d')

Saves the Green’s functions in different files Args:

dtype : Format of the binary data saved.

setGFs(data, strikeslip=[None, None, None], dipslip=[None, None, None], tensile=[None, None, None], vertical=False)

Stores the Green’s functions matrices into the fault structure. Args:

  • data : Data structure from gps or insar.

  • strikeslip : List of matrices of the Strikeslip Green’s functions, ordered E, N, U

  • dipslip : List of matrices of the dipslip Green’s functions, ordered E, N, U

  • tensile : List of matrices of the tensile Green’s functions, ordered E, N, U

If you provide InSAR GFs, these need to be projected onto the LOS direction already.

setGFsFromFile(data, strikeslip=None, dipslip=None, tensile=None, vertical=False, dtype='d')

Sets the Green’s functions from binary files. Be carefull, these have to be in the good format (i.e. if it is GPS, then GF are E, then N, then U, optional, and if insar, GF are projected already) Args:

  • data : Data structure from gps or insar.

  • strikeslip : File containing the Green’s functions for strikeslip displacements.

  • dipslip : File containing the Green’s functions for dipslip displacements.

  • tensile : File containing the Green’s functions for tensile displacements.

  • vertical : Deal with the UP component (gps: default is false, insar, it will be true anyway).

  • dtype : Type of binary data.

slip2dis(data, patch, slip=None)

Computes the surface displacement at the data location using okada.

Args:
  • data : data object from gps or insar.

  • patch : number of the patch that slips

  • slipif a number is given, that is the amount of slip along strike

    if three numbers are given, that is the amount of slip along strike, along dip and opening if None, values from slip are taken

surfacesimulation(box=None, disk=None, err=None, npoints=None)

Takes the slip vector and computes the surface displacement that corresponds on a regular grid. Args:

  • box : Can be a list of [minlon, maxlon, minlat, maxlat].

  • disk : list of [xcenter, ycenter, radius, n]

trace(Lon, Lat)

Set the surface fault trace.

Args:
  • Lon : Array/List containing the Lon points.

  • Lat : Array/List containing the Lat points.

trace2xy()

Transpose the surface trace of the fault into the UTM reference.

writeEDKSgeometry(ref=None)

This routine spits out 2 files: filename.lonlatdepth: Lon center | Lat Center | Depth Center (km) | Strike | Dip | Length (km) | Width (km) | patch ID filename.END: Easting (km) | Northing (km) | Depth Center (km) | Strike | Dip | Length (km) | Width (km) | patch ID

These files are to be used with /home/geomod/dev/edks/MPI_EDKS/calcGreenFunctions_EDKS_subRectangles.py

Args:
  • ref : Lon and Lat of the reference point. If None, the patches positions is in the UTM coordinates.

writeEDKSsubParams(data, edksfilename, amax=None, plot=False)

Write the subParam file needed for the interpolation of the green’s function in EDKS. Francisco’s program cuts the patches into small patches, interpolates the kernels to get the GFs at each point source, then averages the GFs on the pacth. To decide the size of the minimum patch, it uses St Vernant’s principle. If amax is specified, the minimum size is fixed. Args:

  • data : Data object from gps or insar.

  • edksfilename : Name of the file containing the kernels.

  • amax : Specifies the minimum size of the divided patch. If None, uses St Vernant’s principle.

  • plot : Activates plotting.

Returns:
  • filename : Name of the subParams file created.

writePatches2File(filename, add_slip=None, scale=1.0)

Writes the patch corners in a file that can be used in psxyz. Args:

  • filename : Name of the file.

  • add_slip : Put the slip as a value for the color. Can be None, strikeslip, dipslip, total.

  • scale : Multiply the slip value by a factor.

writeSlipContour2File(filename)

Writes the slip contour to a file.

writeSlipDirection2File(filename, scale=1.0, factor=1.0, neg_depth=False)

Write a psxyz compatible file to draw lines starting from the center of each patch, indicating the direction of slip. Tensile slip is not used… scale can be a real number or a string in ‘total’, ‘strikeslip’, ‘dipslip’ or ‘tensile’