MonitorClient

class mss_dataserver.monitorclient.monitorclient.MonitorClient(project, server_url, stations, monitor_stream, stream_lock, data_dir, event_dir, process_interval, stop_event, asyncio_loop, pgv_sps=1, autoconnect=False, pgv_archive_time=1800, trigger_thr=1e-05, warn_thr=1e-05, valid_event_thr=0.0001, felt_thr=0.0001, event_archive_timespan=48, min_event_length=2, min_event_detections=2)[source]

Bases: obspy.clients.seedlink.easyseedlink.EasySeedLinkClient

A custom SeedLink client

Parameters
  • project (mss_dataserver.core.project.Project) – The mss_dataserver project.

  • server_url (str) – The URL of the server.

  • stations (list of str) – The stations to request from the seedlink server.

  • monitor_stream (obspy.Stream) – The stream instance used to save the incoming data.

  • stream_lock (threading.Lock) – The lock object used to for thread-save access of the stream data.

  • data_dir (str) – The data directory.

  • event_dir (str) – The event directory.

  • process_interval (float) – The time interval [s] used to process the received data.

  • stop_event (threading.Event) – The event used to signal the stopping of the program execution.

  • asyncio_loop (asyncio.EventLoop) – The asyncio event loop. Used to stop the loop if an error occurs.

  • pgv_sps (float) – The samples per second of the PGV data stream.

  • autoconnect (boolean) – The obspy.easyseedlink.EasySeedLinkClient autoconnect parameter.

  • pgv_archive_time (float) – The length of the archive stream to keep [s].

  • trigger_thr (float) – The event trigger threshold [m/s].

  • warn_thr (float) – The event warning threshold [m/s].

  • valid_event_thr (float) – The threshold to declare an event as a valid event [m/s].

  • felt_thr (float) – The threshold above which an event is considered as a felt event [m/s].

  • event_archive_timespan (float) – The timespan used to load archived events [h].

  • min_event_length (float) – The minimum length of an event [s]. Events smaller than this value are ignored.

  • min_event_detections (int) – The minimum number of detections for an event to be saved in the archive.

Properties

capabilities

The server’s capabilities, parsed from INFO:CAPABILITIES (cached).

Methods

__init__(project, server_url, stations, …)

Initialize the instance.

close()

Close the SeedLink connection.

compute_pgv(stream)

Compute the PGV values of the stream.

compute_pgv_res()

Compute the resultant of the peak-ground-velocity.

connect()

Connect to the SeedLink server.

convert_to_physical_units(stream)

Convert the counts to physical units.

detect_event()

Run the Voronoi event detection.

detect_event_warning()

Run the Voronoi detection with the most recent PGV data only.

export_event(export_event)

Save the event.

get_current_event()

Return the current event in serializable form.

get_current_pgv()

Get the current PGV data.

get_equal_length_traces()

Get a stream containing traces with equal length per station.

get_event_by_id([ev_id, public_id])

Get an event by event id or public id.

get_event_supplement(public_id, selection)

Get the detailed data of an event.

get_event_supplement_dir(public_id[, category])

Get the supplement directory of an event.

get_event_warning()

Return the current event warning in serializable form.

get_info(level)

Send a SeedLink INFO command and retrieve response.

get_keydata()

Return the keydata.

get_pgv_timeseries()

Get the latest PGV timeseries data.

get_pgv_timeseries_archive([nsl_code])

Get the archived PGV timeseries data.

get_recent_events()

Return the recent events in serializable form.

get_recorder_mappings([station_nsl])

Get the mappings of the requested NSLC.

get_station_metadata()

Get the metadata of the available stations.

get_triggered_event_stations()

Get the stations which have triggered during the last event.

get_triggered_stations()

Get the stations which have a PGV exceeding the threshold value.

has_capability(capability)

Check if the SeedLink server has a certain capability.

has_info_capability(capability)

A shortcut for checking for INFO capabilities.

load_archive_catalogs([hours])

Load the event catalogs of the specified last days.

load_archive_file()

Load data from the JSON archive file.

load_from_archive()

Load data from a saved archive.

on_data(trace)

Override the on_data callback function.

on_seedlink_error()

Handle client errors.

on_terminate()

Handle termination of the client.

process_monitor_stream()

Process the data in the monitor stream.

reconnect()

Reconnect to the server.

reset()

Reset the monitorclient to an initial state.

run()

Start streaming data from the SeedLink server.

save_event_supplement(export_event)

Save the supplement data of the event.

save_supplement_detection_data(event, output_dir)

Save the detection data of the event.

save_supplement_inventory(event, output_dir)

Save the supplement inventory data to a json file.

save_supplement_metadata(event, pgv_stream, …)

Save the supplement metadata to a json file.

save_supplement_pgv(event, pre_win, …)

Save the PGV data supplement.

save_supplement_vel(event, pre_win, …)

Save the velocity data supplement.

save_to_archive(key)

Save data to the JSON archive.

seedlink_connect()

Connect to the seedlink server.

select_stream(net, station[, selector])

Select a stream for data transfer.

task_timer(callback)

A timer executing a task at regular intervals.

trim_archive()

Crop the archive to a specified length.

trim_archive_catalogs([hours])

Trim the catalogs in the library to the given timespan.

Inheritence diagram

Inheritance diagram of mss_dataserver.monitorclient.monitorclient.MonitorClient