seisflows.tools.graphics
Basic visualization tools for SeisFlows to visualize waveforms, models, etc.
Module Contents
Functions
|
Plots values of a SPECEFM2D model/gradient on an unstructured grid |
|
Plots values of a SPECEFM2D model/gradient by interpolating onto a regular grid |
|
Plots a vector or time series. |
|
Plots a seismic section from an Obspy stream. |
|
Extracts trace data from an obspy stream and returns a 2D array. |
|
Return limits for colormap. |
|
Get fixed time vector for stream object. |
|
Return offsets. |
|
Returns regular tick intervals. |
- seisflows.tools.graphics.plot_2d_contour(x, z, data, cmap='viridis', zero_midpoint=False)
Plots values of a SPECEFM2D model/gradient on an unstructured grid
- Parameters
x (np.array) – x values of GLL mesh
z (np.array) – z values of GLL mesh
data (np.array) – D
cmap (str) – matplotlib colormap to be applied to the contour plot. Defaults to ‘viridis’
zero_midpoint (bool) – set 0 as the midpoint for the colorbar. Useful for diverging colorscales (e.g., for gradients), where the neutral color (e.g., white) is set at value=0
- seisflows.tools.graphics.plot_2d_image(x, z, data, cmap='viridis', zero_midpoint=False, resX=1000, resZ=1000)
Plots values of a SPECEFM2D model/gradient by interpolating onto a regular grid
- Parameters
x (np.array) – x values of GLL mesh
z (np.array) – z values of GLL mesh
data (np.array) – D
cmap (str) – matplotlib colormap to be applied to the contour plot. Defaults to ‘viridis’
zero_midpoint (bool) – set 0 as the midpoint for the colorbar. Useful for diverging colorscales (e.g., for gradients), where the neutral color (e.g., white) is set at value=0
resX (int) – number of points for the interpolation in x- direction (default=1000)
resZ (int) – number of points for the interpolation in z- direction (default=1000)
- seisflows.tools.graphics.plot_vector(t, v, xlabel='', ylabel='', title='')
Plots a vector or time series. If dimensions of v are greater than 2, raises ValueError
- Parameters
t (np.ndarray) – Time axis for potting
v (np.ndarray) – Vector or time series to plot, ndims = 1/2
xlabel (str) – x axis label
ylabel (str) – y axis label
title (str) – plot title
- seisflows.tools.graphics.plot_section(stream, ax=None, cmap='seismic', clip=100, title='', x_interval=1.0, y_interval=1.0)
Plots a seismic section from an Obspy stream.
Parameters
- stream: Obspy stream object
Obspy stream object created from a SU data file
- ax: Matplotlib Axes object
Optional axis object
- cmap: str
Matplotlib colormap option.
- clip: float
Percentage value (0-100) for amplitude clipping
- title: str
plot title
- x_interval: float
Offset axis tick interval in km
- y_interval: float
Time axis tick interval in km
Raises
- NotImplementedError
If stream object does not have SU format
- seisflows.tools.graphics._convert_to_array(stream)
Extracts trace data from an obspy stream and returns a 2D array.
Parameters
- stream: Obspy stream object
Stream storing trace data
Returns
- output: ndarray, ndim=2
Returns an (nt*nr) array. nt and nr are the number of sample points and number of traces respectively. Assumes trace lengths are equal for all traces.
Raises
- TypeError
If stream is not an obspy stream
- seisflows.tools.graphics._cscale(v, clip=100)
Return limits for colormap.
- seisflows.tools.graphics._get_time(stream)
Get fixed time vector for stream object.
- seisflows.tools.graphics._get_offsets(stream)
Return offsets.
- seisflows.tools.graphics.get_regular_ticks(v, interval)
Returns regular tick intervals.