Class Stream

Contains the definition of SAUL’s Stream class.

class saul.waveform.stream.Stream[source]

A subclass of ObsPy’s Stream class with extra functionality.

See the docstring for that class for documentation on the attributes and methods inherited by this class.

classmethod from_earthscope(network, station, channel, starttime, endtime, location='*', cache=False)[source]

Create a SAUL Stream object containing waveforms obtained from EarthScope servers.

This class method wraps waveform_collection.server.gather_waveforms() with the source argument set to 'IRIS'. Wildcards (*, ?) are accepted for the network, station, channel, and location parameters. The user can optionally choose to cache waveform data to avoid redundant data download for repeated identical requests (see cache argument).

Warning

Caching (see cache argument), while convenient, is sketchy since data are not guaranteed to be the same between calls!

Parameters:
  • network (str) – SEED network code

  • station (str) – SEED station code

  • channel (str) – SEED channel code

  • starttime (tuple or UTCDateTime) – Start time for data request; for tuple input the format is integers: (year, month, day[, hour[, minute[, second[, microsecond]]])

  • endtime (tuple or UTCDateTime) – End time for data request (same format as starttime)

  • location (str) – SEED location code

  • cache (bool) – Toggle whether to cache the gather_waveforms() function call to avoid downloading data again in subsequent calls

Returns:

Newly-created object with the server-obtained waveforms in units of integer counts

Return type:

SAUL Stream

classmethod from_local(data_dir, coord_file, network, station, channel, starttime, endtime, location='*')[source]

Create a SAUL Stream object containing waveforms obtained from local files.

This class method wraps waveform_collection.local.local.read_local(). Wildcards (*, ?) are accepted for the network, station, channel, and location parameters.

Parameters:
  • data_dir (str) – Directory containing miniSEED files

  • coord_file (str) – JSON file containing coordinates for local stations (full path required)

  • network (str) – SEED network code

  • station (str) – SEED station code

  • channel (str) – SEED channel code

  • starttime (tuple or UTCDateTime) – Start time for data request; for tuple input the format is integers: (year, month, day[, hour[, minute[, second[, microsecond]]])

  • endtime (tuple or UTCDateTime) – End time for data request (same format as starttime)

  • location (str) – SEED location code

Returns:

Newly-created object with the locally obtained waveforms

Return type:

SAUL Stream

to_kml(filename='saul.Stream.kml', ge=False)[source]

Write the SAUL Stream station locations to a KML file and optionally open it.

Adopted from the ObsPy code here.

Parameters:
  • filename (str) – Output KML file name (including path)

  • ge (bool) – If True, immediately open the output KML file in Google Earth Pro (only supported on macOS systems with Google Earth Pro installed)

plot(*args, **kwargs)[source]

Modify this method to always plot into a new figure, and make record section plotting easier.

If the user specifies src_lat and src_lon, type='section' is assumed and distances are automatically calculated. This saves the user from having to calculate these in a prior step. If this plotting mode is used, the user can also specify a wavespeed to plot a moveout line on the record section.

Parameters:
  • src_lat (int or float) – Source latitude [°]

  • src_lon (int or float) – Source longitude [°]

  • wavespeed (int or float) – Moveout line [m/s] to plot on the record section

Note

Can obtain standard obspy.core.stream.Stream.plot() behavior by setting fig=None.