class lasif.components.query.QueryComponent(communicator, component_name)[source]

This component is responsible for making queries across the different components and integrating them in a meaningful way.

  • communicator – The communicator instance.
  • component_name – The name of this component for the communicator.

It should thus be initialized fairly late as it needs access to a number of other components via the communicator.

discover_available_data(event_name, station_id)[source]

Discovers the available data for one event at a certain station.

Will raise a LASIFNotFoundError if no raw data is found for the given event and station combination.

  • event_name (str) – The name of the event.
  • station_id (str) – The id of the station in question.
Return type:



Return a dictionary with “processed” and “synthetic” keys. Both values will be a list of strings. In the case of “processed” it will be a list of all available preprocessing tags. In the case of the synthetics it will be a list of all iterations for which synthetics are available.


Returns a list of all stations for one event.

A station is considered to be available for an event if at least one channel has raw data and an associated station file. Furthermore it must be possible to derive coordinates for the station.

Parameters:event_name (str) – Name of the event.
>>> import pprint
>>> comm = getfixture('query_comm')
>>> pprint.pprint(comm.query.get_all_stations_for_event(
...     "GCMT_event_TURKEY_Mag_5.1_2010-3-24-14-11"))         
{u'HL.ARG': {'elevation_in_m': 170.0, 'latitude': 36.216,
             'local_depth_in_m': 0.0, 'longitude': 28.126},
 u'HT.SIGR': {'elevation_in_m': 93.0, 'latitude': 39.2114,
              'local_depth_in_m': 0.0, 'longitude': 25.8553},
 u'KO.KULA': {'elevation_in_m': 915.0, 'latitude': 38.5145,
              'local_depth_in_m': 0.0, 'longitude': 28.6607},
 u'KO.RSDY': {'elevation_in_m': 0.0, 'latitude': 40.3972,
              'local_depth_in_m': 0.0, 'longitude': 37.3273}}

Raises a LASIFNotFoundError if the event does not exist.

>>> comm.query.get_all_stations_for_event("RandomEvent")
Traceback (most recent call last):
LASIFNotFoundError: ...
get_coordinates_for_station(event_name, station_id)[source]

Get the coordinates for one station.

Must be in sync with get_all_stations_for_event().

get_data_and_synthetics_iterator(iteration, event)[source]

Get the processed data and matching synthetics for a particular event.

get_iteration_status(iteration, events=None)[source]

Return the status of an iteration. This is a query command as it integrates a lot of different information.

  • iteration – The iteration which to query.
  • events – If given, only the events of those events will be queried. Otherwise all will be queried.

Returns a dictionary of events, each containing the following keys: "missing_raw", "missing_processed", "missing_synthetic", "fraction_of_stations_that_have_windows"

Each of those is a list of stations missing for that particular data type.


Returns a dictionary with a list of stations per event.

point_in_domain(latitude, longitude)[source]

Tests if the point is in the domain. Returns True/False

  • latitude – The latitude of the point.
  • longitude – The longitude of the point.

Debug function returning a string with information about the file. Useful as a debug function and to figure out what LASIF is doing.

Parameters:path – The path to the file.