pySW4.postp.waveforms module

Routines for reading a line or an array of synthetic waveforms.

author:Shahar Shani-Kadmiel (s.shanikadmiel@tudelft.nl)
copyright:Shahar Shani-Kadmiel (s.shanikadmiel@tudelft.nl)
license:This code is distributed under the terms of the GNU Lesser General Public License, Version 3 (https://www.gnu.org/copyleft/lesser.html)

SW4 uses a right handed coordinate system

     X
   ⋰
 ⋰
o------->Y
|
|
V
Z

If the azimuth of the SW4 grid is 0 this translates to:

  • X == Northing
  • Y == Easting
  • Z == Vertical (inverted!)
class Stations(name=None, path='./', mode='velocity', verbose=False, traces=None)[source]

Bases: obspy.core.stream.Stream

Class to handle waveform data from a line or an array of seismograms.

Read a line or an array of stations constructed using station_line() or station_array() in the preprocess phase.

Parameters:

name : str

For a single station give the name of the station used in the inputfile in the file field. For all stations relating to a line or array of stations use the prefix of the line or array name, should be equal to the value used for 'name' in station_line() or station_array() in the preprocess phase.

path : str

Path (relative or absolute) to the files (default is ‘./’).

mode : {‘displacement’, ‘velocity’, ‘div’, ‘curl’, ‘strains’}

Mode of the rec files to be read.

_parse_rec_filename(filename)[source]

Private method: Parse ‘rec’ filename and get the x, y or lat, lon coordinates.

delta
get_data(channel='*z')[source]

Get data for the selected channel. Wildcard are also handled such that channel='*z' gets all vertical channels in self.traces.

See select() method for more info.

Returns:

3D ndarray

3darray of shape (nx, ny, time).

plot_traces(mode='', yscale='auto', hspace=0.2, wspace=0.05, figsize=None, fig=None, **kwargs)[source]

Plot all traces and their Fourier specra side-by-side.

Parameters:

traces : Stream

Traces to be plotted in an Stream object.

mode : {‘displacement’, ‘velocity’, ‘div’, ‘curl’, ‘strains’}

Mode describes the type of data in traces.

Optionaly, an alternative string can be given that will be used as the y-label of the time-histories.

yscale : {‘auto’, ‘all’, ‘normalize’}

Set the scale of the vertical y-axis:

  • auto - Vertical scale of each axes is automatically set to the -|max| and |max| of each trace.
  • all - Vertical scale of all axes is set to the same limits which are the -|max| and |max| of all traces.
  • normalize - Each trace is normalized and plotted (ylim=(-1, 1)).

hspace : float

The hight space between axes. See GridSpec documentation.

wspace : float

The width space between axes. See GridSpec documentation.

figsize : 2-tuple

Size of the Figure.

fig : Figure

A Figure instance.

Other Parameters:
 

kwargs : plot() propeties.

starttime
times()[source]
read_stations(name, path='./', mode='velocity', verbose=False)[source]

Read a single station or several stations along a line or as an array constructed using station_line() or station_array() in the preprocess phase.

Parameters:

name : str

For a single station give the name of the station used in the inputfile in the file field. For all stations relating to a line or array of stations use the prefix of the line or array name, should be equal to the value used for 'name' in station_line() or station_array() in the preprocess phase.

path : str

Path (relative or absolute) to the files (default is ‘./’).

mode : {‘displacement’, ‘velocity’, ‘div’, ‘curl’, ‘strains’}

Mode of the rec files to be read.

Returns:

Stations

Class with waveform data and methods.