TriangularTents class¶
- class csi.TriangularTents(name, utmzone=None, ellps='WGS84', lon0=None, lat0=None, verbose=True)¶
Classes implementing a fault made of triangular tents. Inherits from Fault
- Args:
name : Name of the fault.
- Kwargs:
utmzone : UTM zone (optional, default=None)
lon0 : Longitude of the center of the UTM zone
lat0 : Latitude of the center of the UTM zone
ellps : ellipsoid (optional, default=’WGS84’)
verbose : Speak to me (default=True)
- Facet2Nodes(homogeneousStrike=False, homogeneousDip=False, keepFacetsSeparated=False)¶
Transfers the edksSources list into the node based setup.
- Kwargs:
honogeneousStrike : In a tent, the strike varies among the faces. This variation can be a problem if the variation in strikes is too large, with slip that can partially cancel each other. If True, the strike of each of the point is equal to the strike of the main node of the tent.
homogeneousDip : Same thing for the dip angle.
keepFacetsSeparated : If True, each facet of each node will have a different identifier (int). This is needed when computing the Green’s function for the Node based case.
- Returns:
None
- addTent(tent, slip=[0, 0, 0])¶
Append a tent to the current list.
- Args:
tent : tent to add
- Kwargs:
slip : List of the strike, dip and tensile slip.
- Returns:
None
- addTents(tents, slip=None)¶
Adds a list of tents
- Args:
tents : tent to add
- Kwargs:
slip : List of the strike, dip and tensile slip.
- Returns:
None
- buildAdjacencyMap(verbose=True)¶
For each triangle vertex, find the indices of the adjacent triangles. This function overwrites that from the parent class TriangularPatches.
- Kwargs:
verbose : Speak to me
- Returns:
None
- buildLaplacian(verbose=True, method='distance', irregular=False)¶
Build a discrete Laplacian smoothing matrix.
- Args:
verbose : if True, displays stuff.
method : Method to estimate the Laplacian operator
‘count’ : The diagonal is 2-times the number of surrounding nodes. Off diagonals are -2/(number of surrounding nodes) for the surrounding nodes, 0 otherwise.
‘distance’: Computes the scale-dependent operator based on Desbrun et al 1999. (Mathieu Desbrun, Mark Meyer, Peter Schr”oder, and Alan Barr, 1999. Implicit Fairing of Irregular Meshes using Diffusion and Curvature Flow, Proceedings of SIGGRAPH).
irregular : Not used, here for consistency purposes
- Returns:
Laplacian : 2D array
- buildTentAdjacencyMap(verbose=True)¶
For each triangle vertex, finds the indices of the surrounding vertices. This function runs typically after buildAdjacencyMap.
- Kwargs:
verbose : Speak to me
- Returns:
None
- chooseTents(tents)¶
Choose a subset of tents (indices)
- Args:
tents : List of indices
- Returns:
None
- computeSlipDirection(scale=1.0, factor=1.0, ellipse=False, nsigma=1.0)¶
Computes the segment indicating the slip direction.
- Kwargs:
scale : can be a real number or a string in ‘total’, ‘strikeslip’, ‘dipslip’ or ‘tensile’
factor: multiplcative factor
ellipse: compute the error ellipse as well
nsigma: Int number of sigma for the ellipse calculation
- Returns:
None. Slip direction is stored in self.slipdirection
- computeTentArea()¶
Computes the area for each node. Stores it in self.area_tent
- Returns:
None
- computetotalslip()¶
Computes the total slip.
- deleteTent(tent)¶
Deletes a tent.
- Args:
tent : index of the tent to remove.
- Returns:
None
- deleteTents(tents)¶
Deletes a list of tent (indices)
- Args:
tents : list of indices
- Returns:
None
- distanceMatrix(distance='center', lim=None)¶
Returns a matrix of the distances between Nodes.
- Kwargs:
distance : distance 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].
- Returns:
distance : 2d array
- distancesMatrix(distance='center', lim=None)¶
Returns two matrices of the distances between Nodes. One along horizontal dimensions, the other along the vertical axis
- Kwargs:
distance : distance 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].
- Returns:
distance : 2d array
- findNodes(lon, lat, round=2)¶
Find the nodes with lon and lat (np.array or list)
- Args:
lon : array or float of longitude
lat : array or float of latitude
- Kwargs:
round : Round to how many decimals
- Returns:
Indices of the nodes : list
- getDepths()¶
Returns the depth of each nodes.
- getDips()¶
Returns the dip of each nodes.
- getEllipse(tent, ellipseCenter=None, Npoints=10, factor=1.0, nsigma=1.0)¶
Compute the ellipse error given Cm for a given tent
- Kwargs:
center : center of the ellipse
Npoints : number of points on the ellipse
factor : scaling factor
nsigma : will design a nsigma*sigma error ellipse
- Returns:
Ellipse : 3D array with the ellipse
- getStrikes()¶
Returns the strikes of each nodes.
- getTentInfo(tent)¶
Returns the geometry info related to vertex-based tent parameterization
- Args:
tent : index of the wanted tent or tent;
- Returns:
x, y, z, strike, dip : Tent Informations
- getTentindex(tent)¶
Returns the index of a tent.
- Args:
tent : element of self.tents
- Returns:
iout : integer
- getcenters()¶
Returns a list of nodes.
- initializeFromFault(fault, adjMap=True)¶
Initializes the tent fault object from a triangularPatches or a triangularTents instance.
- Args:
fault : Instance of triangular fault.
- Kwargs:
adjMap : Build the adjacency map (True/False).
- Returns:
None
- initializeslip(n=None, values=None)¶
Re-initializes the fault slip array to zero values. This function over-writes the function in the parent class Fault.
- Kwargs:
n : Number of slip values. If None, it’ll take the number of patches.
values: Can be depth, strike, dip, length, area or a numpy array
- Returns:
None
- patches2triangles(fault, numberOfTriangles=4)¶
Takes a fault with rectangular patches and splits them into triangles to initialize self.
- Args:
fault : instance of rectangular patches.
- Kwargs:
numberOfTriangles : Split each patch in 2 or 4 (default) triangle
- Returns:
None
- plot(figure=134, slip='total', figsize=(None, None), Map=True, Fault=True, show=True, norm=None, linewidth=1.0, plot_on_2d=True, alpha=1.0, method='scatter', npoints=10, cmap='jet', shadedtopo=False, view=None, colorbar=True, cbaxis=[0.1, 0.2, 0.1, 0.02], cborientation='horizontal', cblabel='', drawCoastlines=False, expand=0.2, vertIndex=False, savefig=False)¶
Plot the available elements of the fault.
- Kwargs:
figure : Number of the figure.
slip : What slip to plot
equiv : For consistentcy issues
show : show me
axesscaling : Scale the axes
norm : colorbar limits
linewidth : Line width in points
plot_on_2d : Plot on a map as well?
method : ‘scatter’ or ‘surface’ (scatter is better)
npoints : how many points per triangle
colorbar : True/False
cmap : color map in matplotlib
drawCoastlines: Self-explanatory argument
expand : Expand the map by {expand} degrees
vertIndex : ?????
- readGocadPatches(filename, neg_depth=False, utm=False, factor_xy=1.0, factor_depth=1.0, verbose=False)¶
Load a triangulated Gocad surface file. Vertices must be in geographical coordinates.
- Args:
filename: tsurf file to read
- Kwargs:
neg_depth: if true, use negative depth
utm: if true, input file is given as utm coordinates (if false -> lon/lat)
factor_xy: if utm==True, multiplication factor for x and y
factor_depth: multiplication factor for z
- readPatchesFromFile(filename, readpatchindex=True, donotreadslip=False, inputCoordinates='lonlat')¶
Reads patches from a GMT formatted file.
- Args:
filename : Name of the file
- Kwargs:
inputCoordinates : Default is ‘lonlat’. Can be ‘utm’
readpatchindex : Default True.
donotreadslip : Default is False. If True, does not read the slip
inputCoordinates : Default is ‘lonlat’, can be ‘xyz’
- Returns:
None
- slipIntegrate(slip=None, factor=1.0)¶
Integrates slip on the patch. Stores integration in self.volume
- Args:
slip : slip vector. Can be strikeslip, dipslip, tensile, coupling or a list/array of floats.
factor : multiply slip vector
- Returns:
None
- vertices2tents()¶
Takes the list of vertices and builds the tents.
- Returns:
None
- writeNodes2File(filename, add_slip=None, scale=1.0, stdh5=None, decim=1)¶
Writes the tent node in a file that can be used in psxyz.
- Args:
filename : Name of the file.
- Kwargs:
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.
stdh5 : Get standrad dev from a h5file
decim : Decimate the h5 file
- Returns:
None
- writePatches2File(filename, add_slip=None, scale=1.0, stdh5=None, decim=1)¶
Writes the patch corners in a file that can be used in psxyz.
- Args:
filename : Name of the file.
- Kwargs:
add_slip : Will be set to None
scale : Multiply the slip value by a factor.
patch : Can be ‘normal’ or ‘equiv’
stdh5 : Get std dev from an h5 file
decim : decimate the h5 file
- Returns:
None
- writeSlipDirection2File(filename, scale=1.0, factor=1.0, neg_depth=False, ellipse=False, nsigma=1.0)¶
Write a psxyz compatible file to draw lines starting from the center of each patch, indicating the direction of slip.
- Args:
filename : Name of the output file
- Kwargs:
scale : scale of the arrows (can a real number of a string within ‘total’, ‘strikeslip’, ‘dipslip’ or ‘tensile’
factor : scaling factor for the vectors
neg_depth : If True, depth will be a negative number
ellipse : Write error ellipses in a separate file
nsigma : Int number of sigma values for the ellipse
- writeSources2Grd(filename, npoints=10, slip='strikeslip', increments=None, nSamples=None, outDir='./', mask=False, noValues=nan)¶
Writes the values of slip in two grd files:
z_{filename}
{slip}_{filename}
- Args:
filename : Name of the grdfile (should end by grd or nc)
- Kwargs:
slip : Slip value to store.
mask : If true,builds a mask based on the outer boundary of the fault.
nSamples : How many samples on each axis
increments : Size of increments along each axis
outDir : Output directory
noValues : What to write when there is no value
- Returns:
None