geodeticplot class

class csi.geodeticplot(lonmin, latmin, lonmax, latmax, figure=None, pbaspect=None, resolution='auto', figsize=[None, None], Map=True, Fault=True)

A class to create plots of geodetic data with faults. Geographic representation is based on cartopy. Two figures are created. One with a map and the other with a 3D view of the fault.

Args:
  • lonmin : left-boundary of the map

  • lonmax : Right-boundary of the map

  • latmin : Bottom-boundary of the map

  • latmax : Top of the map

Kwargs:
  • figure : Figure number

  • pbaspect : ??

  • resolution : Resolution of the mapped coastlines, lakes, rivers, etc. See cartopy for details

  • figsize : tuple of the size of the 2 figures

Returns:
  • None

addColorbar(values, scalarMap, cbaxis, cborientation, figure, cblabel='')

Adds a colorbar for a given {scalarMap} to the chosen {figure}

Args:
  • values : Values used fr the plot

  • scalaMap : Scalar Mappable from matplotlib

  • cbaxis : [Left, Bottom, Width, Height] shape of the axis in which the colorbar is plot

  • cborientation : ‘horizontal’ or ‘vertical’

  • figure : Figure object

Kwargs:
  • cblabel : Label the colorbar

beachball(fm, xy, facecolor='k', bgcolor='white', edgecolor='k', linewidth=2, width=200, size=100, alpha=1.0, zorder=3)

Plots a beach ball from a GCMT moment tensor. See obspy.imaging.beachball.beach to have a description of the arguments.

Args:
  • fm : Focal mechanism (M11, M22, M33, M12, M13, M23, Harvard convention)

  • xy : Tuple of (lon, lat)

Returns:
  • None:

clf()

Clears the figures

Returns:
  • None

close(fig2close=['map', 'fault'])

Closes all the figures

Kwargs:
  • fig2close : a list of ‘map’ and ‘fault’. By default, closes both figures

Returns:
  • None

drawCoastlines(color='k', linewidth=1.0, linestyle='solid', resolution='10m', landcolor='lightgrey', seacolor=None, drawMapScale=None, parallels=None, meridians=None, drawOnFault=False, alpha=0.5, zorder=1)

Draws the coast lines in the desired area.

Kwargs:
  • color : Color of lines

  • linewidth : Width of lines

  • linestyle : Style of lines

  • resolution : Resolution of the coastline. Can be 10m, 50m or 110m

  • drawLand : Fill the continents (True/False)

  • drawMapScale : Draw a map scale (None or length in km)

  • parallels : If int, number of parallels. If float, spacing in degrees between parallels. If np.array, array of parallels

  • meridians : Number of meridians to draw or array of meridians

  • drawOnFault : Draw on 3D fault as well

  • zorder : matplotlib order of plotting

Returns:
  • None

drawCountries(scale='110m', linewidth=1.0, edgecolor='gray', facecolor='lightgray', alpha=1.0, zorder=0)

See the cartopy manual for options

drawScaleBar(scalebar, csiobj, lonlat=None, zorder=0, textoffset=10.0, linewidth=1, color='k', fontdict=None)

Draw a {scalebar} km bar for scale at {lonlat}.

earthquakes(earthquakes, plot='2d3d', color='k', markersize=5, norm=None, colorbar=False, cbaxis=[0.1, 0.2, 0.1, 0.02], cborientation='horizontal', cblabel='', cmap='jet', zorder=2, alpha=1.0, linewidth=0.1)

Plot earthquake catalog

Args:
  • earthquakes : object from seismic locations.

Kwargs:
  • plot : any combination of 2d and 3d.

  • color : color of the earthquakes. Can be an array.

  • markersize : size of each dots. Can be an array.

  • norm : upper and lower bound for the color code.

  • colorbar : Draw a colorbar.

  • cbaxis : [Left, Bottom, Width, Height] of the colorbar axis

  • cborientation : ‘horizontal’ (default)

  • cblabel : Write something next to the colorbar.

  • zorder : order of the plot in matplotlib

Returns:
  • None

equalize3dAspect()

Make the 3D axes have equal aspect. Not working yet (maybe never).

Returns:
  • None

faultTents(fault, slip='strikeslip', norm=None, colorbar=True, alpha=1.0, cbaxis=[0.1, 0.2, 0.1, 0.02], cborientation='horizontal', cblabel='', method='scatter', cmap='jet', plot_on_2d=False, revmap=False, factor=1.0, npoints=10, xystrides=[100, 100], zorder=0, vertIndex=False)

Plot a fault with tents.

Args:
  • fault : TriangularTent fault instance

Kwargs:
  • slip : Can be ‘strikeslip’, ‘dipslip’, ‘tensile’, ‘total’ or ‘coupling’

  • norm : Limits for the colorbar.

  • colorbar : if True, plots a colorbar.

  • method : Can be ‘scatter’ (plots all the sub points as a colored dot) or ‘surface’ (interpolates a 3D surface which can be ugly…)

  • cmap : matplotlib colormap

  • plot_on_2d : if True, adds the patches on the map.

  • revmap : Reverse the default colormap

  • factor : Scale factor for fault slip values

  • npoints : Number of subpoints per patch. This number is only indicative of the actual number of points that is picked out by the dropSourcesInPatch function of EDKS.py. It only matters to make the interpolation finer. Default value is generally alright.

  • xystrides : If method is ‘surface’, then xystrides is going to be the number of points along x and along y used to interpolate the surface in 3D and its color.

  • vertIndex : Writes the index of the vertices

Returns:
  • None

faultpatches(fault, slip='strikeslip', norm=None, colorbar=True, cbaxis=[0.1, 0.2, 0.1, 0.02], cborientation='horizontal', cblabel='', plot_on_2d=False, revmap=False, linewidth=1.0, cmap='jet', offset=None, alpha=1.0, factor=1.0, zorder=3, edgecolor='slip', colorscale='normal')

Plot the fualt patches

Args:
  • fault : Fault instance

Kwargs:
  • slip : Can be ‘strikeslip’, ‘dipslip’, ‘tensile’, ‘total’ or ‘coupling’

  • norm : Limits for the colorbar.

  • colorbar : if True, plots a colorbar.

  • cbaxis : [Left, Bottom, Width, Height] of the colorbar axis

  • cborientation : ‘horizontal’ (default)

  • cblabel : Write something next to the colorbar.

  • plot_on_2d : if True, adds the patches on the map.

  • revmap : Revert the colormap

  • linewidth : Width of the edges of the patches

  • cmap : Colormap (any of the matplotlib ones)

  • factor : scale factor for fault slip values

  • zorder : matplotlib order of plotting

  • edgecolor : either a color or ‘slip’

  • colorscale : ‘normal’ or ‘log’

Returns:
  • None

faultsimulation(fault, norm=None, colorbar=True, cbaxis=[0.1, 0.2, 0.1, 0.02], cborientation='horizontal', cblabel='', direction='north')

Plot a fault simulation, Not tested in a long time… Might be obsolete.

Args:
  • fault : fault object

Kwargs:
  • norm : List of lower and upper bound of the colorbar.

  • colorbar : activates the plotting of the colorbar.

  • direction : which direction do we plot (‘east’, ‘north’, ‘up’, ‘total’ or a given azimuth in degrees, or an array to project in the LOS).

Returns:
  • None

faulttrace(fault, color='r', add=False, discretized=False, linewidth=1, zorder=1)

Plots a fault trace.

Args:
  • fault : Fault instance

Kwargs:
  • color : Color of the fault.

  • add : plot the faults in fault.addfaults

  • discretized : Plot the discretized fault

  • zorder : matplotlib order of plotting

Returns:
  • None

gps(gps, data=['data'], color=['k'], scale=None, legendscale=10.0, legendunit='', linewidths=0.1, name=False, error=True, zorder=5, alpha=1.0, width=0.005, headwidth=3, headlength=5, headaxislength=4.5, minshaft=1, minlength=1, quiverkeypos=(0.1, 0.1))
Args:
  • gps : gps object from gps.

Kwargs:
  • data : List of things to plot. Can be any list of ‘data’, ‘synth’, ‘res’, ‘strain’, ‘transformation’

  • color : List of the colors of the gps velocity arrows. Must be the same size as data

  • scale : Scales the arrows

  • legendscale : Length of the scale.

  • linewidths : Width of the arrows.

  • name : Plot the name of the stations (True/False).

  • zorder : Order of the matplotlib rendering

Returns:
  • None

gpsprojected(gps, norm=None, colorbar=True, cbaxis=[0.1, 0.2, 0.1, 0.02], cborientation='horizontal', cblabel='', zorder=4, cmap='jet', alpha=1.0)

Plot the gps data projected in the LOS

Args:
  • gps : gps instance

Kwargs:
  • norm : List of lower and upper bound of the colorbar.

  • colorbar : activates the plotting of the colorbar.

  • cmap : Colormap, by default ‘jet’

  • zorder : order of the plot in matplotlib

Returns:
  • None

gpsverticals(gps, norm=None, colorbar=True, cbaxis=[0.1, 0.2, 0.1, 0.02], cborientation='horizontal', cblabel='', data=['data'], markersize=[10], linewidth=0.1, zorder=4, cmap='jet', marker='o', alpha=1.0)

Scatter plot of the vertical displacement of the GPS.

Args:
  • gps : gps instance

Kwargs:
  • norm : limits of the colormap

  • colorbar : True/False

  • data : list of ‘data’, ‘synth’, ‘res’

  • markersize : Size of the markers. List of the same size as data

  • linewidth : width of the edge of the markers

  • cmap : Colormap from matplotlib

  • marker : type of marker

  • zorder : plotting order in matplotlib

Returns:
  • None

insar(insar, norm=None, colorbar=True, markersize=1, lognorm=False, cbaxis=[0.2, 0.2, 0.1, 0.01], cborientation='horizontal', cblabel='', data='data', plotType='scatter', cmap='jet', los=None, decim=1, zorder=3, edgewidth=1, alpha=1.0)

Plot an insar object

Args:
  • insar : insar object from insar.

Kwargs:
  • norm : lower and upper bound of the colorbar.

  • colorbar : plot the colorbar (True/False).

  • cbaxis : [Left, Bottom, Width, Height] of the colorbar axis

  • cborientation : ‘horizontal’ (default)

  • cblabel : Write something next to the colorbar.

  • data : plot either ‘data’ or ‘synth’ or ‘res’ or ‘err’.

  • plotType : Can be ‘decimate’ or ‘scatter’

  • los : [lon, lat, length, fontsize (default=16), mutation_scale (default=90), ‘flip’]

  • decim : In case plotType=’scatter’, decimates the data by a factor decim.

  • edgewidth : width of the patches in case plotTtype is decimate

  • zorder : order of the plot in matplotlib

Returns:
  • None

opticorr(corr, norm=None, colorbar=True, cbaxis=[0.1, 0.2, 0.1, 0.02], cborientation='horizontal', cblabel='', data='dataEast', plotType='decimate', decim=1, zorder=3)

Plot opticorr instance

Args:
  • corr : instance of the class opticorr

Kwargs:
  • norm : lower and upper bound of the colorbar.

  • colorbar : plot the colorbar (True/False).

  • cbaxis : [Left, Bottom, Width, Height] of the colorbar axis

  • cborientation : ‘horizontal’ (default)

  • cblabel : Write something next to the colorbar.

  • data : plot either ‘dataEast’, ‘dataNorth’, ‘synthNorth’, ‘synthEast’, ‘resEast’, ‘resNorth’, ‘data’, ‘synth’ or ‘res’

  • plotType : plot either rectangular patches (decimate) or scatter (scatter)

  • decim : decimation factor if plotType=’scatter’

  • zorder : order of the plot in matplotlib

Returns:
  • None

pressuresource(fault, delta='pressure', norm=None, colorbar=True, cbaxis=[0.1, 0.2, 0.1, 0.02], cborientation='horizontal', cblabel='', revmap=False, linewidth=1.0, cmap='jet', alpha=1.0, factor=1.0, zorder=3, plot_on_2d=False)

Plots a pressure source.

Args:
  • fault : Pressure source instance

Kwargs:
  • delta : Can be ‘pressure’ or ‘volume’

  • norm : Limits for the colorbar.

  • colorbar : if True, plots a colorbar.

  • revmap : Reverts the colormap

  • linewidth : width of the edhe of the source

  • cmap : matplotlib colormap

  • plot_on_2d : if True, adds the patches on the map.

  • factor : scale factor for pressure values

  • zorder : matplotlib plotting order

Returns:
  • None

savefig(prefix, mapaxis='equal', ftype='pdf', dpi=None, bbox_inches=None, triDaxis='auto', saveFig=['fault', 'map'])

Save to file.

Args:
  • prefix : Prefix used for filenames

Kwargs:
  • mapaxis : ‘equal’ or ‘auto’

  • ftype : ‘eps’, ‘pdf’, ‘png’

  • dpi : whatever dot-per-inche you’d like

  • bbox_inches : pdf details

  • triDaxis : 3D axis scaling

  • saveFig : Which figures to save

Returns:
  • None

set_view(elevation, azimuth, shape=(1.0, 1.0, 1.0))

Sets azimuth and elevation angle for the 3D plot.

Args:
  • elevation : Point of view elevation angle

  • azimuth : Point of view azimuth angle

Kwargs:
  • shape : [scale_x, scale_y, scale_z] (0-1 each)

Returns:
  • None

set_xymap(xlim, ylim)

Sets the xlim and ylim on the map.

Args:
  • xlim : tuple of the ongitude limits

  • ylim : tuple of the latitude limits

Returns:
  • None

setzaxis(depth, zticklabels=None)

Set the z-axis.

Args:
  • depth : Maximum depth.

Kwargs:
  • ztickslabel : which labels to use

Returns:
  • None

shadedTopography(source='gebco', smooth=3, azimuth=140, altitude=45, alpha=1.0, zorder=1, cmap='Greys', norm=None, gebcotype='sub_ice_topo', gebcoyear=2022, srtmversion=1)
if source == ‘gebco’:

Plots the shaded topography Gebco. Needs user to download Gebco data and store that in ~/.local/share/cartopy/GEBCO

if source == ‘srtm’:

Plots the shaded topography from SRTM. Thanks to Thomas Lecocq. Needs user to download the SRTM tiles and unzip them beforehand (until the day cartopy guru’s manage to input a login and password to access directly SRTM data). Tiles must be stored at ~/.local/share/cartopy/SRTM/SRTMGL1 or in the directory given by the environment variable CARTOPY_DATA_DIR (which must be set before importing cartopy)

Args:
  • smooth : Smoothing factor in pixels of SRTM data (3 is nice)

  • azimuth : Azimuth of the sun

  • elevation : Sun elevation

  • alpha : Alpha

  • srtmversion : 1 or 3

  • gebcotype : ‘sub_ice_topo’

  • gebcoyear : 2022

Returns:
  • None

show(mapaxis=None, triDaxis=None, showFig=['fault', 'map'], fitOnBox=False)

Show to screen

Kwargs:
  • mapaxis : Specify the axis type for the map (see matplotlib)

  • triDaxis : Specify the axis type for the 3D projection (see mpl_toolkits)

  • showFig : List of plots to show on screen (‘fault’ and/or ‘map’)

  • fitOnBox : If True, fits the horizontal axis to the one asked at initialization

Returns:
  • None

slipdirection(fault, linewidth=1.0, color='k', scale=1.0, zorder=10, markersize=10, factor=1.0)

Plots segments representing the direction of slip along the fault.

Args:
  • fault : Instance of a fault

Kwargs:
  • linewidth : Width of the line

  • color : Color of the line

  • scale : Multiply slip

Returns:
  • None

surfacestress(stress, component='normal', linewidth=0.0, norm=None, colorbar=True, cbaxis=[0.1, 0.2, 0.1, 0.02], cborientation='horizontal', cblabel='')

Plots the stress on the map.

Args:
  • stress : Stressfield object.

Kwargs:
  • component : If string, can be normal, shearstrike, sheardip. If tuple or list, can be anything specifying the indexes of the Stress tensor.

  • linewidth : option of scatter.

  • norm : Scales the color bar.

  • colorbar : if true, plots a colorbar

  • cbaxis : [Left, Bottom, Width, Height] of the colorbar axis

  • cborientation : ‘horizontal’ (default)

  • cblabel : Write something next to the colorbar.

Returns:
  • None

titlefault(titre)

Sets the title of the fault model.

Args:
  • titre : title of the fault

Returns:
  • None

titlemap(titre, y=1.1)

Sets the title of the map.

Args:
  • titre : title of the map

Returns:
  • None