swspy.io package
Submodules
swspy.io.load module
- class swspy.io.load.load_waveforms(path, starttime=None, endtime=None, archive_vs_file='archive', downsample_factor=1, upsample_factor=1, sac=False)
Bases:
objectA class to load waveforms from file or an archive.
Notes: - Will currently only load archived data from the format year/jul_day/station - Does not currently remove instrument response
- Parameters:
path (str) – The path to the overall data archive or file to load waveforms from.
archive_vs_file (str (default = "archive")) – Describes what the parameter <path> is associated with. If archive, then <path> is to an archive. If file, then <path> is the path to a obspy readable file (e.g. mseed). Default is archive.
starttime (obspy UTCDateTime object) – The starttime to cut the data by. Any filters are applied before cutting. If not supplied then will load all data from the supplied file path (archive_vs_file must = file for this to be valid).
endtime (obspy UTCDateTime object) – The endtime to cut the data by. Any filters are applied before cutting. If not supplied then will load all data from the supplied file path (archive_vs_file must = file for this to be valid).
- filter
If True, then filters the data by <filter_freq_min_max>.
- Type:
bool (default = False)
- filter_freq_min_max
Filter parameters for filtering the data.
- Type:
list of two floats (default = [2.0, 20.0])
- zero_phase
If True, applies zero phase filter (if <filter> = True).
- Type:
bool (default = True)
- remove_response
If True, removes instrument response using the response file specified by <response_file>. (Note: Not currently implemented!)
- Type:
bool (default = False)
- response_file_path
Path to response file used to remove instrument response.
- Type:
str (default = None)
- downsample_factor
Factor by which to downsample the data, to speed up processing. If <downsample_factor> = 1, obviously doens’t apply downsampling.
- Type:
int (default = 1)
- upsample_factor
Factor by which to upsample the data, to smooth waveforms for enhanced timeshift processing. Currently uses weighted average slopes interpolation method. If <upsample_factor> = 1, doens’t apply upsampling.
- Type:
int (default = 1)
- sac
If passing sac data, will read in sac headers to output directly for doing the splitting analysis. Note that currently doesn’t read a ray inclination angle, so sets to come in vertically. Explicitly, reads the following information from the sac headers: The arrival time of the phase to use (in secs after trace start time). Default header is <a>, but user can specify a different value (e.g. <t0>) by using the class attribute <sac_s_pick_hdr>. baz - The back-azimuth from receiver to event (in deg from N). (also reads station from the stream headers). If sac = True, then read_waveform_data() will output the dictionary sac_info as part of the class, with the following keys: event_id - id for the event, set from the sac input fname. stations - Receiver ids. s_arrival_times - S-wave arrival times in UTCDateTime fmt. bazs - Back-azimuths. incs - Ray inclination angles (all = 0 degrees from vertical).
- Type:
bool (default = False)
- sac_s_pick_hdr
The sac header to use for the S pick arrival time. Value is float with units of seconds from start of trace.
- Type:
str (default = a)
- read_waveform_data(stations=[], channels='*')
Read in the waveform data for the specified time.
- read_waveform_data(stations=None, channels='*', event_uid='*')
Function to read waveform data. Filters if specified.
- Parameters:
stations (list of strs (default = None)) – List of stations to import. If None then imports all available stations (default).
channels (str (default = "*")) – List of channels to import. Default is to import all channels.
Returns –
st (obspy stream) – Obspy stream object containing all the data requested.
swspy.io.read_nonlinloc module
Module contents
Submodule for dealing with input and output management