WaveformsComponent¶
-
class
lasif.components.waveforms.
WaveformsComponent
(data_folder, synthetics_folder, communicator, component_name)[source]¶ Component managing the waveform data.
Parameters: - data_folder – The data folder in a LASIF project.
- synthetics_folder – The synthetics folder in a LASIF project.
- communicator – The communicator instance.
- component_name – The name of this component for the communicator.
Returns the available processing tags for a given event.
Parameters: event_name – The event name.
-
get_available_synthetics
(event_name)[source]¶ Returns the available synthetics for a given event.
Parameters: event_name – The event name.
-
get_metadata_for_file
(absolute_filename)[source]¶ Returns the metadata for a certain file.
Parameters: absolute_filename – The absolute path of the file.
-
get_metadata_processed
(event_name, tag)[source]¶ Get the processed metadata.
Parameters: - event_name – The name of the event.
- tag – The processing tag.
-
get_metadata_processed_for_station
(event_name, tag, station_id)[source]¶ Get the processed metadata for a single station.
Same as
get_metadata_processed()
but for a single station.Parameters: - event_name – The name of the event.
- tag – The processing tag.
- station_id – The id of the station in the form
NET.STA
.
-
get_metadata_raw
(event_name)[source]¶ Returns the available metadata at the channel level for the raw waveforms and the given event_name.
Parameters: event_name – The name of the event. Returns: A list of dictionaries, each describing channel level data at a particular point in time. In most instances, the
latitude
,longitude
,elevation_in_m
, andlocal_depth_in_m
values will beNone
as station information is usually retrieved from the station metadata file. SAC files are an exception.>>> import pprint >>> comm = getfixture('waveforms_comm') >>> pprint.pprint(sorted(comm.waveforms.get_metadata_raw( ... "GCMT_event_TURKEY_Mag_5.1_2010-3-24-14-11"), ... key=lambda x: x["channel_id"])) [{'channel': u'BHE', 'channel_id': u'HL.ARG..BHE', 'elevation_in_m': None, 'endtime': UTCDateTime(2010, 3, 24, 15, 11, 30, 974999), 'filename': u'/.../HL.ARG..BHE.mseed', 'latitude': None, 'local_depth_in_m': None, 'location': u'', 'longitude': None, 'network': u'HL', 'starttime': UTCDateTime(2010, 3, 24, 14, 6, 31, 24999), 'station': u'ARG'}, {...}, ...]
Each dictionary will have the following keys.
>>> sorted(comm.waveforms.get_metadata_raw( ... "GCMT_event_TURKEY_Mag_5.1_2010-3-24-14-11")[0].keys()) ['channel', 'channel_id', 'elevation_in_m', 'endtime', 'filename', 'latitude', 'local_depth_in_m', 'location', 'longitude', 'network', 'starttime', 'station']
A
LASIFNotFoundError
will be raised, if no raw waveform data is found for the specified event.>>> comm.waveforms.get_metadata_raw("RandomEvent") Traceback (most recent call last): ... LASIFNotFoundError: ...
-
get_metadata_raw_for_station
(event_name, station_id)[source]¶ Returns the available metadata at the channel level for the raw waveforms and the given event_name at a certain station.
Same as
get_metadata_raw()
just for only a single station.Parameters: - event_name – The name of the event.
- station_id – The station id.
Returns: A list of dictionaries, each describing channel level data at a particular point in time.
-
get_metadata_synthetic
(event_name, long_iteration_name)[source]¶ Get the synthetics metadata.
Parameters: - event_name – The name of the event.
- long_iteration_name – The long form of the iteration name.
- station_id – The id of the station in the form
NET.STA
.
-
get_metadata_synthetic_for_station
(event_name, long_iteration_name, station_id)[source]¶ Get the synthetics metadata for a single station.
Same as
get_metadata_synthetic()
but for a single station.Parameters: - event_name – The name of the event.
- long_iteration_name – The long form of the iteration name.
- station_id – The id of the station in the form
NET.STA
.
-
get_waveform_cache
(event_name, data_type, tag_or_iteration=None, dont_update=False)[source]¶ Parameters: - event_name – The name of the event.
- data_type – The data type.
- tag_or_iteration – If processed data, the tag, if synthetic data, the iteration.
- dont_update – If True, an existing cache will not be updated but returned as is. If it does not exist, it will be updated regardless.
-
get_waveform_folder
(event_name, data_type, tag_or_iteration=None)[source]¶ Returns the folder where the waveforms are stored.
Parameters: - event_name – Name of the event.
- data_type – The type of data, one of
"raw"
,"processed"
,"synthetic"
- tag_or_iteration – The processing tag or iteration name if any.
-
get_waveforms_processed
(event_name, station_id, tag)[source]¶ Gets the processed waveforms for the given event and station as a
Stream
object.Parameters: - event_name – The name of the event.
- station_id – The id of the station in the form
NET.STA
. - tag – The processing tag.
-
get_waveforms_raw
(event_name, station_id)[source]¶ Gets the raw waveforms for the given event and station as a
Stream
object.Parameters: - event_name – The name of the event.
- station_id – The id of the station in the form
NET.STA
.
-
get_waveforms_synthetic
(event_name, station_id, long_iteration_name)[source]¶ Gets the synthetic waveforms for the given event and station as a
Stream
object.Parameters: - event_name – The name of the event.
- station_id – The id of the station in the form
NET.STA
. - long_iteration_name – The long form of an iteration name.