pyglimer.ccp#

pyglimer.ccp.ccp#

Module for the Common Conversion Stack Computation and handling of the objects resulting from such.

copyright:

The PyGLImER development team (makus@gfz-potsdam.de).

license:

GNU Lesser General Public License, Version 3 (https://www.gnu.org/copyleft/lesser.html)

author:

Peter Makus (makus@gfz-potsdam.de)

Created: Friday, 10th April 2020 05:30:18 pm Last Modified: Thursday, 27th October 2022 07:01:06 pm

class pyglimer.ccp.ccp.CCPStack(latitude: List[float], longitude: List[float], edist: float, phase: str, verbose: bool = True, logdir: Optional[str] = None, _load: Optional[str] = None)[source]#

Bases: object

Is a CCP Stack matrix. Its size depends upon stations that are used as input.

Creates an empy object template for a CCP stack.

Parameters:
  • latitude (1-D numpy.ndarray) – Latitudes of all seismic stations.

  • longitude (1-D numpy.ndarray) – Longitudes of all seismic stations.

  • edist (float) – Inter bin distance in angular distance.

  • phase (str) – Seismic phase either “S” or “P”. Phase “S” will lead to more grid points being created due to flatter incidence angle. Hence, phase can be “S” for PRFs but not the other way around. However, “P” is computationally more efficient.

  • verbose (bool, optional) – If true -> console output. The default is True.

  • logdir – Directory for log file

  • _load (str) – Parameter is only used internally when loading from a binary numpy file. Then, this passes a filename.

compute_kdtree_volume(qlon: Optional[ndarray] = None, qlat: Optional[ndarray] = None, zmax: Optional[float] = None, verbose: bool = True)[source]#

Using the CCP kdtree, we get the closest few points and compute the weighting using a distance metric. if points are too far away, they aren’t weighted

Parameters:
  • qlon (np.ndarray or list) – grid defining array for longitude

  • qlat (np.ndarray or list) – grid defining array for latitude

  • zmax (float, optional) – maximum depth to compute.

  • gz (np.array or list) – grid defining array for z

  • r (float or None) – outside r everything is nan

  • minillum (int or None, optional) – Minimum number of illumation points use in the interpolation, everything below is downweighted by the square reciprocal

Returns:

[description]

Return type:

[type]

compute_stack(vel_model: str, rfloc: str, in_format: str = 'hdf5', preproloc: Optional[str] = None, network: Optional[str] = None, station: Optional[str] = None, geocoords: Optional[tuple] = None, pattern: Optional[list] = None, save: str = False, filt: Optional[tuple] = None, binrad: float = 0.5773502691896258, append_pp: bool = False, multiple: bool = False, mc_backend: str = 'joblib')[source]#

Computes a ccp stack in self.ccp, using the data from rfloc. The stack can be limited to some networks and stations.

Parameters:
  • vel_model (str) – Velocity model located in data. Either iasp91.dat for 1D raytracing or 3D for 3D raytracing with GYPSuM model. Using 3D Raytracing will cause the code to take about 30% longer.

  • rfloc (str, optional) – Parental folder in which the receiver functions in time domain are. The default is ‘output/waveforms/RF.

  • in_format (str, optional) – INPUT FORMAT of receiver functions. Either ‘sac’ or ‘hdf5’. Defaults to ‘hdf5’.

  • preproloc (str, optional) – Parental folder containing the preprocessed mseeds. Only needed if option geocoords is used. The default is None. Should be None if hdf5 is used!

  • network (str or list, optional) – This parameter is ignored if the pattern is given. Network or networks that are to be included in the ccp stack. Standard unix wildcards are allowed. If None, the whole database will be used. The default is None.

  • station (str or list, optional) – This parameter is ignored if the pattern is given. Station or stations that are to be included in the ccp stack. Standard unix wildcards are allowed. Can only be list if type(network)=str. If None, the whole database will be used. The default is None.

  • geocoords (Tuple, optional) – Include all stations in the rectangle given by (minlat, maxlat, minlon, maxlon). Will be ignored if pattern or network is given, by default None.

  • pattern (list, optional) – Search pattern for files. Overwrites network, station, and geocooords options. Usually only used by init_ccp(), defaults to None.

  • save (str or bool, optional) – Either False if the ccp should not be saved or string with filename will be saved in config.ccp. Will be saved as pickle file.

  • filt (tuple, optional) – Decides whether to filter the receiver function prior to depth migration. Either a Tuple of form (lowpassf, highpassf) or None / False.

  • binrad (float, optional) – Defines the bin radius with bin radius = binrad*distance_bins. Full Overlap = 1/(2*cosd(30)), Full coverage: 1. The default is full overlap.

  • append_pp (bool, optional) – appends piercing point coordinates if True, so they can later be plotted. Not recommended for big data sets. The default is false. Deprecated for multi-core

  • multiple (bool, optional) – Append receiver functions for first order multiples. It can be decided later, whether they should be used in the final ccp stack. Will result in a longer computation time.

  • mc_backend – Multi-core backend to use for the computations. Can be either “joblib” (multiprocessing) or “MPI”. Not that MPI compatibility is only implemented with hdf5 files.

Raises:

ValueError – For wrong inputs

Warning

This will take a long while for big data sets!

Note

When using, mc_backend=’MPI’. This has to be started from a terminal via mpirun.

Note

MPI is only compatible with receiver functions saved in hdf5 format.

Note

Note that the grid should be big enough for the provided networks and stations. Best to create the CCPStack object by using init_ccp().

conclude_ccp(keep_empty: bool = False, keep_water: bool = False, r: int = 0, multiple: bool = False, z_multiple: int = 200)[source]#

Averages the CCP-bin and populates empty cells with average of neighbouring cells. No matter which option is chosen for the parameters, data is never lost entirely. One can always execute a new conclude_ccp() command. However, decisions that are taken here will affect the .mat output and plotting outputs.

Parameters:
  • keep_empty (bool, optional) – Keep entirely empty bins. The default is False.

  • keep_water (bool, optional) – For False all bins that are on water-covered areas will be discarded, defaults to False

  • r (int, optional) – Fields with less than r hits will be set equal 0. r has to be >= 1, defaults to 3.

  • multiple (bool or str) – Use multiples in stack. Either False or weigthing; i.e. ‘linear’ for linearly weighted stack between the three phases, ‘zk’ for a Zhu & Kanamori approach, or ‘pws’ for a phase weighted stack. Use ‘m1’ to use only first multiple mode (no stack), ‘m2’ for RFs created only with 2nd multiple phase (PSS), and m for an equal-weight stack of m1 and m2. By default False.

  • z_multiple (int, optional) – Until which depth [km] should multiples be considered, maximal value is 200 [km]. Will only be used if multiple=True. By default 200 km.

create_vtk_mesh(geo=True, bbox: Optional[list] = None, filename: Optional[str] = None)[source]#

Creates a mesh with given bounding box s

Parameters:
  • geo (bool, optional) – flag whether the output mesh is in geographical coordinates or meters, by default True

  • bbox (list or None, optional) – bounding box [minlon, maxlon, minlat, maxlat]. If None No boundaries are taken, by default None

  • filename (str or None, optional) – If set, the computed grid will be output as VTK file under the given filename. This file can then later be opened using either the plotting tool or, e.g., Paraview. If None, no file is written. By default, None.

Returns:

outputs a vtk mesh that can be opened in, e.g., Paraview.

Return type:

VTK.UnstructuredGrid

explore(qlon: Optional[ndarray] = None, qlat: Optional[ndarray] = None, zmax: Optional[float] = None)[source]#

Creates a volume exploration window set. One window is for all plots, and the other window is generated with sliders such that one can explore how future plots should be generated. It technically does not require any inputs, as simply the binning size will be used to create a meshgrid fitting to the bin distance distribution. One can however fix the extent and size of the grid by defining the grids coordinate vectors.

Parameters:
  • qlon (np.ndarray, optional) – Longitude gridpoints for the Grid. Defines longitudinal extent and resolution. If None, it’s determined automatically from the CCPStacks resolution and grid extent. Must be monotonically increasing.

  • qlat (np.ndarray, optional) – Latitude gridpoints for the Grid. Defines latitudinal extent and resolution. If None, it’s determined automatically from the CCPStacks resolution and grid extent. Must be monotonically increasing.

  • zmax (float, optional) – Maximum depth (km) that the CCP-exploration extends to.

Return type:

VolumeExploration

map_plot(plot_stations: bool = False, plot_bins: bool = False, plot_illum: bool = False, profile: Optional[list] = None, p_direct: bool = True, outputfile: Optional[str] = None, format: str = 'pdf', dpi: int = 300, geology: bool = False, title: Optional[str] = None)[source]#

Create a map plot of the CCP Stack containing user-defined information.

Parameters:
  • plot_stations (bool, optional) – Plot the station locations, by default False

  • plot_bins (bool, optional) – Plot bin location, by default False

  • plot_illum (bool, optional) – Plot bin location with colour depending on the depth-cumulative illumination at bin b, by default False

  • profile (list or tupleor None, optional) – Plot locations of cross sections into the plot. Information about each cross section is given as a tuple (lon1, lon2, lat1, lat2), several cross sections are given as a list of tuples in said format, by default None.

  • p_direct (bool, optional) – If true the list in profile decribes areas with coordinates of the lower left and upper right corner, by default True

  • outputfile (str or None, optional) – Save plot to file, by default None

  • format (str, optional) – Format for the file to be saved as, by default ‘pdf’

  • dpi (int, optional) – DPI for none vector format plots, by default 300

  • geology (bool, optional) – Plot a geological map. Requires internet connection

  • title (str, optional) – Set title for plot.

multicore_stack(stream: List[str], append_pp: bool, n_closest_points: int, vmodel: str, latb: Tuple[float, float], lonb: Tuple[float, float], filt: Tuple[float, float], multiple: bool) Tuple[List[int], List[int], List[ndarray], List[ndarray], List[ndarray]][source]#

Takes in chunks of data to be processed on one core.

Parameters:
  • stream (list) – List of file locations.

  • append_pp (Bool) – Should piercing points be appended?.

  • n_closest_points (int) – Number of Closest points that the KDTree should query.

  • vmodel (str) – Name of the velocity model that should be used for the raytraycing.

  • latb (Tuple) – Tuple in Form (minlat, maxlat). To save RAM on 3D raytraycing. Will remain unused for 1D RT.

  • lonb (Tuple) – Tuple in Form (minlon, maxlon). To save RAM on 3D raytraycing. Will remain unused for 1D RT

  • filt (bool or tuple]) – Should the RFs be filtered before the ccp stack? If so, provide (lowcof, highcof).

Returns:

Three lists containing indices and rf-data.

Return type:

list, list, list

pick_phase(pol: str = '+', depth: list = [None, None]) PhasePick[source]#

Pick the strongest negative or strongest positive gradient from a predefined depth-range.

Parameters:
  • pol (str, optional) – Either ‘+’ for positive velocity gradient or ‘-’ for negative gradient, by default ‘+’

  • depth (list, optional) – List with two elements [minz, maxz], defines in which depth window the phase picker is gonna look for maxima and minima, by default [None, None]

Returns:

A phasepick object, which subsequently can be plotted.

Return type:

PhasePick

Raises:

ValueError – For errandeous inputs.

plot_bins()[source]#

A simple map view of the bins.

plot_cross_section(*args, **kwargs)[source]#

See documentation for plot_cross_section()

plot_volume_sections(qlon: ndarray, qlat: ndarray, zmax: Optional[float] = None, lonsl: Optional[float] = None, latsl: Optional[float] = None, zsl: Optional[float] = None, r: Optional[float] = None, minillum: Optional[int] = None, show: bool = True)[source]#

Creates the same plot as the explore tool, but(!) statically and with more options left to the user.

!!! IT IS IMPORTANT for the plotting function that the input arrays are monotonically increasing!!!

Parameters:
  • qlon (np.ndarray) – Monotonically increasing ndarray. No failsafes implemented.

  • qlat (np.ndarray) – Monotonically increasing ndarray. No failsafes implemented.

  • z (np.ndarray) – Monotonically increasing ndarray. No failsafes implemented.

  • lonsl (float or None, optional) – Slice location, if None, the center of lon is used, by default None

  • latsl (float or None, optional) – Slice location, if None, the center of lat is used, by default None

  • zsl (float or None, optional) – Slice location, if None, the center of depth is used, by default None

  • r (float or None, optional) – Max radius for interpolation values taken into account [km], if None bingrid.edist * DEG2KM * 2.0, by default None

  • minillum (int or None, optional) – Minimum number of illumation points use in the interpolation, everything below is downweighted by the square reciprocal

  • show (bool, optional) – whether to make figure window visible, default True

Returns:

[description]

Return type:

VolumePlot

query_bin_tree(latitude: ndarray, longitude: ndarray, n_closest_points: int)[source]#

Find closest bins for provided latitude and longitude.

Parameters:
  • latitude (1-D numpy.ndarray) – Latitudes of piercing points.

  • longitude (1-D numpy.ndarray) – Longitudes of piercing points.

  • n_closest_points (int) – Number of closest points to be found.

Returns:

bin index k and depth index j

Return type:

int

write(filename=None, folder='.', fmt='pickle')[source]#

Saves the CCPStream file as pickle or matlab file. Only save as Matlab file for exporting, as not all information can be preserved!

Parameters:
  • filename (str, optional) – Name as which to save, file extensions aren’t necessary.

  • folder (str, optional) – Output folder, defaults to ‘output/ccps’

  • fmt (str, optional) – Either “pickle”, ‘npz’ or “matlab” for .mat, defaults to “pickle”.

Raises:

ValueError – For unknown formats.

Note

Saving in numpy (npz) format is the most robust option. However, loading those files will take the longest time as some attributes have to be recomputed. NUMPY FORMAT IS RECOMMENDED FOR ARCHIVES!

Warning

Pickling files is the fastest option, but might lead to incompatibilities between different PyGLImER versions. USE PICKLE IF YOU WOULD LIKE TO SAVE FILES FOR SHORTER AMOUNTS OF TIME.

Warning

Saving as Matlab files is only meant if one wishes to plot with the old Matlab Receiver function exploration toolset (not recommended anymore).

class pyglimer.ccp.ccp.PhasePick(coords: ndarray, amplitudes: ndarray, polarity: str, z: ndarray, depthrange: list = [None, None])[source]#

Bases: object

A phasepick object, just created for more convenient plotting.

Initialise object

Parameters:
  • coords (np.ndarray) – 2-d array containing latitudes and longitudes.

  • amplitudes (np.ndarray) – 1-D array containg amplitude values of each bin

  • polarity (str) – Either ‘+’ for positive velocity gradients or ‘-’ for negative

  • z (np.ndarray) – 1D array containing depth of maxima/minima per bin

  • depthrange (list, optional) – list containing depth restrictions in form of [zmin, zmax], by default [None, None]

plot(plot_amplitude: bool = False, outputfile: Optional[str] = None, format: str = 'pdf', dpi: int = 300, cmap: str = 'gist_rainbow', geology: bool = False, title: Optional[str] = None)[source]#

Plot heatmap containing depth or amplitude of picked phase.

Parameters:
  • plot_amplitude (bool, optional) – If True amplitude instead of depths is plotted, by default False

  • outputfile (str or None, optional) – Write Figure to file, by default None

  • format (str, optional) – File format, by default ‘pdf’

  • dpi (int, optional) – Resolution for non-vector graphics, by default 300

  • cmap (str, optional) – Colormap

  • geology (bool, optional) – Plot geological map.

  • title

pyglimer.ccp.ccp.init_ccp(rfloc: str, spacing: float, vel_model: str, phase: str, preproloc: Optional[str] = None, network: Optional[str] = None, station: Optional[str] = None, geocoords: Optional[Tuple[float, float, float, float]] = None, compute_stack: bool = False, filt: Optional[Tuple[float, float]] = None, binrad: float = 0.8660254037844386, append_pp: bool = False, multiple: bool = False, save: str = False, verbose: bool = True, format: str = 'hdf5', mc_backend: str = 'joblib') CCPStack[source]#

Computes a ccp stack in self.ccp using data from statloc and rfloc. The stack can be limited to some networks and stations.

Parameters:
  • rfloc (str) – Parental directory in that the RFs are saved.

  • spacing (float) – Angular distance between each bingrid point.

  • vel_model (str) – Velocity model located in data. Either iasp91 (1D raytracing) or 3D for 3D raytracing using a model compiled from GyPSuM.

  • phase (str) – The teleseismic phase to be used.

  • preproloc (str, optional) – Parental directory in that the preprocessed miniseeds are saved, defaults to None. Should be None when working with h5 files!

  • network (str or list, optional) – Network or networks that are to be included in the ccp stack. Standard unix wildcards are allowed. If None, the whole database will be used. The default is None., defaults to None

  • station (str or list, optional) – Station or stations that are to be included in the ccp stack. Standard unix wildcards are allowed. Can only be list if type(network)==str. If None, the whole database will be used. The default is None.

  • geocoords (Tuple, optional) – An alternative way of selecting networks and stations. Given in the form (minlat, maxlat, minlon, maxlon), defaults to None

  • compute_stack (bool, optional) – If true it will compute the stack by calling compute_stack(). That can take a long time! The default is False.

  • filt (Tuple[float, float], optional) – Decides whether to filter the receiver function prior to depth migration. Either a Tuple of form (lowpassf, highpassf) or None / False.

  • binrad (float, optional) – Only used if compute_stack=True Defines the bin radius with bin radius = binrad*distance_bins. Full Overlap = cosd(30), Full coverage: 1. The default is full overlap.

  • append_pp (bool, optional) – Only used if compute_stack=True. Appends piercing point locations to object. Can be used to plot pps on map. Not recommended for large datasets as it takes A LOT longer and makes the file a lot larger. The default is False., defaults to False

  • multiple (bool, optional) – Should the CCP Stack be prepared to work with multiples? It can be chosen later, whether the RFs from multiples are to be incorporated into the CCP Stack. By default False.

  • save (bool or str, optional) – Either False if the ccp should not be saved or string with filename will be saved. Will be saved as pickle file. The default is False.

  • verbose (bool, optional) – Display info in terminal., defaults to True

  • format (str) – The INPUT FORMAT from which receiver functions are read. If you saved your receiver function as hdf5 files, set ==hdf5. Defaults to hdf5.

  • mc_backend – Multi-core backend to use for the computations. Can be either “joblib” (multiprocessing) or “MPI”. Not that MPI compatibility is only implemented with hdf5 files.

Raises:

TypeError – For wrong inputs.

Returns:

CCPStack object.

Return type:

CCPstack

Note

When using, mc_backend=’MPI’. This has to be started from a terminal via mpirun.

Note

MPI is only compatible with receiver functions saved in hdf5 format.

pyglimer.ccp.ccp.read_ccp(filename: str, fmt: Optional[str] = None) CCPStack[source]#

Read CCP-Stack class file from input folder.

Parameters:
  • filename (str, optional) – Filename of the input file with file ending. The default is ‘ccp.pkl’.

  • fmt (str, optional) – File format, can be none if the filename has an ending, possible options are “pickle” or “npz”. The default is None.

Raises:

ValueError – For unknown formats

Returns:

CCPStack object

Return type:

CCPStack

Note

Loading Files from numpy format will take a while as some recomputations are necessary.

pyglimer.ccp.io#

This module will handle file IO. The problematic functions here are the incoming .mat files that are produced by the GLImER database.

copyright:

The PyGLImER development team (makus@gfz-potsdam.de).

license:

GNU Lesser General Public License, Version 3 (https://www.gnu.org/copyleft/lesser.html)

author:

Lucas Sawade (lsawade@princeton.edu)

pyglimer.ccp.io.load_rawrf(filename)[source]#

Loads a matlab raw RF file.

Parameters:

filename (str) – filename of the receiver function .mat-file to be loaded. The .mat-file is expected to contain following parameters. See Notes below for required content of matlab rawRf file.

Returns:

Set of RF variables

Return type:

rfs, baz, rayp, lat, lon, elev, dt

Notes

File content

Crfs:

MxN matrix of M Receiver Functions and N elements

Cbaz:

M elements long vector with back azimuth values corresponding to Receiver functions

Crayp:

M elements long vector with ray parameter values corresponding to Receiver functions

Cslat:

M elements long vector with station latitude corresponding to Receiver functions

Cslon:

M elements long vector with station longitude corresponding to Receiver functions

Celev:

M elements long vector with station elevation

Dt:

sampling interval

pyglimer.ccp.io.load_tracefile(filename)[source]#

Loading an RF file that has been raytraced.

pyglimer.ccp.io.load_velocity_model(filename)[source]#

Loads velocity model and outputs velocities and corresponding parameters.

Parameters:

filename

Return type:

vlat, vlon, vdep, vp, vs

pyglimer.ccp.compute.bin#

copyright:

The PyGLImER development team (makus@gfz-potsdam.de).

license:

GNU Lesser General Public License, Version 3 (https://www.gnu.org/copyleft/lesser.html)

author:

Peter Makus (makus@gfz-potsdam.de) Lucas Sawade (lsawade@princeton.edu)

Created: November 2019 Last Modified: Thursday, 21st October 2021 10:05:06 am

class pyglimer.ccp.compute.bin.BinGrid(latitude: ndarray, longitude: ndarray, edist: float, phase: str, verbose: bool = True)[source]#

Bases: object

Creates Bingrid object from parameters

BinGrid object that can be used to find closest neighbours to stations and CCP bins

Parameters:
  • latitude (1-D numpy.array) – Latitudes

  • longitude (1-D numpy.array) – Longitudes

  • edist (float) – Distance (in degree) between bin centres.

  • phase (str) – Seismic phase either “S” or “P”. Phase “S” will lead to more grid points being created due to flatter incidence angle. Hence, phase can be “S” for PRFs but not the other way around. However, “P” is computationally more efficient.

  • verbose (bool, optional) – consoel output?, defaults to True

compute_bins()[source]#

Computes bins close to all stations

query_bin_tree(latitude, longitude, binrad, k)[source]#

Uses the query function of the KDTree but takes geolocations as input.

Parameters:
  • latitude (1-D numpy.ndarray) – latitudes to be queried

  • longitude (1-D numpy.ndarray) – longitudes to be queried

  • binrad (float) – maximum distance to be queried in euclidean distance Equals the radius of the bin, higher = more averaging -> –> less noise, lower resolution

  • k (int) – Number of neighbours to return. Note that this directly depends on the ratio of deltabin/binrad.

Returns:

Indices of next neighbour.

Return type:

1D np.array

query_station_tree(latitude, longitude, maxdist)[source]#

Uses the query function of the KDTree but takes geolocations as input.

Parameters:
  • latitude (1D numpy.ndarray) – latitudes to be queried

  • longitude (1D numpy.ndarray) – longitudes to be queried

  • maxdist (float) – maximum distance to be queried in degree

Returns:

Euclidian distances to next point, indices of next neighbour.

Return type:

Tuple with 2 1D numpy.ndarray

station_tree()[source]#

Using the input

pyglimer.ccp.compute.bin.fibonacci_sphere(epi: float = 1)[source]#

Creates a Fibonacci sphere, which is a reasonable approximaton for equal distance points on a sphere.

Parameters:

epi (float, optional) – distance between the closest points in degree, defaults to 1

Returns:

a one dimensional array containing the cartesian points [x, y, z] for each index.

Return type:

np.ndarray[List[float]]

pyglimer.ccp.plot_utils.plot_cross_section#

pyglimer.ccp.plot_utils.plot_cross_section.get_ax_coor(ax, lat, lon)[source]#

Just a way to get axes coordinates

Parameters:
  • ax (axes) – Givenn axes

  • lat (float) – Latitude

  • lon (float) – Longitude

Returns:

Axes coordinates for a given set of lat, lon.

Return type:

Tuple

Notes

Authors:

Lucas Sawade (lsawade@princeton.edu)

Last Modified:

2021.08.20 11.00 (Lucas Sawade)

pyglimer.ccp.plot_utils.plot_cross_section.plot_cross_section(ccp, lat, lon, ddeg: float, z0: Optional[float] = None, ax: Optional[Axes] = None, geoax: Optional[Union[GeoAxes, GeoAxesSubplot]] = None, mapplot: bool = True, minillum: int = 50, vmin: Optional[float] = None, vmax: Optional[float] = None, low_clip: Optional[float] = None, up_clip: Optional[float] = None, label: Optional[str] = None, rfcmap: str = 'seismic', depthextent: Optional[Iterable] = None, mapextent: Optional[Iterable] = None, bold: bool = False, outfile: Optional[str] = None, format: Optional[str] = 'png', dpi: Optional[int] = 300)[source]#

Plots a cross section for given waypoints. If no axes are given, the function will also create figures for the map and the cross section.

Parameters:
  • ccp (CCPStack) – CCPStack as computed using the cpp module

  • lat (Arraylike) – Latitudes of the waypoints defining the cross section

  • lon (Arraylike) – Longitudes of the waypoints defining the cross section

  • ddeg (float) – lateral spacing of the cross section

  • z0 (Optional[float], optional) – if given the map will be plotted with an illumination map at the given depth, by default None

  • ax (Optional[Axes], optional) – Axes to plot the cross section in, by default None

  • geoax (Optional[Union[GeoAxes, GeoAxesSubplot]], optional) – Axes to plot the waypoins in, by default None

  • mapplot (bool, optional) – plot the map or not, by default True

  • minillum (int, optional) – minimum illumination count to not be grayed out, by default 50

  • vmin (Optional[float], optional) – minimum value of the cross section, by default None

  • vmax (Optional[float], optional) – maximum value of the cross section, by default None

  • low_clip (Optional[float],) – All values between lowclip and zero will be shown as zero. By default None.

  • up_clip (Optional[float],) – All values between upclip and zero will be shown as zero. By default None.

  • label (Optional[str], optional) – label to put in the corner of the cross section plot and the cross section waypoints on the map, by default None

  • rfcmap (str, optional) – cmap name for the plotting of the cross section, by default “seismic”

  • depthextent (Optional[Iterable], optional) – List containing two entries defining min and max depth, by default None

  • mapextent (Optional[Iterable], optional) – List of 4 entries defining [minlon,maxlon, minlat, maxlat], by default None

Returns:

ax, geoax

Return type:

Tuple

Notes

Authors:

Lucas Sawade (lsawade@princeton.edu)

Last Modified:

2021.04.21 20.00 (Lucas Sawade)

pyglimer.ccp.plot_utils.plot_line_buffer#

pyglimer.ccp.plot_utils.plot_line_buffer.plot_line_buffer(lat, lon, delta: float = 1, ax=None, **kwargs)[source]#

Takes in lat, lon points and creates circular polygons around it. Merges the polygons of possible

Parameters:
  • lat (np.ndarray) – latitudes of a line

  • lon (np.ndarray) – longitudes of a line

  • delta (float, optional) – epicentral distance of the buffer, by default 1

Returns:

(patch, artist)

Return type:

tuple

Notes

Authors:

Lucas Sawade (lsawade@princeton.edu)

Last Modified:

2021.04.21 20.00 (Lucas Sawade)

pyglimer.ccp.plot_utils.line_buffer#

pyglimer.ccp.plot_utils.line_buffer.line_buffer(lat, lon, delta=1.0)[source]#

Creates buffer around geographical line using from pole rotated cap outlines. This is far from perfect, but it does “a” job. There isn’t much more that one can and be spherically accurate. As long as the amount of points in the line is fair this should have no problem to immitate a true buffer.

Parameters:
  • lat (np.ndarray) – latitudes

  • lon (np.ndarray) – longitudes

  • delta (float, optional) – epicentral distance to line, by default 1.0

Returns:

Nx2 matrix with coordinates of a polygon that forms a buffer around the line

Return type:

np.ndarray

Notes

Authors:

Lucas Sawade (lsawade@princeton.edu)

Last Modified:

2021.04.21 20.00 (Lucas Sawade)