class documentation

This is the Builders Super Class

All Builders should implement the BaseBuilder class

Static Method event_list Generate a printout list of individual events in the request
Static Method filter_channels Filter channels to be requested.
Static Method filter_netsta Filter the request based on the items, mode and operation.
Static Method filter_netStationEvent Filter out request lines that are already listed in the existing list.
Static Method filter_timewindow Filter out request lines not overlaping with this datetime range
Static Method load_request Load a request from file
Static Method map_request Make a map using cartopy representing the request.
Static Method reqlen Count the total number of lines in request
Static Method request_stats Show some stats from the request
Static Method save_request Save a built request to file
Static Method show_request Write a summary of the request to the screen
Static Method station_list Generate a printout list of individual stations in the request
Static Method stev_list Generate a printout list of events and stations in the request
Method setAllowRestricted Enable of disable the use of restricted station while building the request
Method setShowEvents Show events obtained from server before continuing to build the request.
Static Method __x_list Undocumented
Static Method _getChannelList Undocumented
Method __build_event_dictionary t0 is a UTCDateTime eventLatitude is degrees eventLongitude is degrees eventDepth is in Meters
Method __build_pick_dictionary Undocumented
Method __build_station_dictionary networkCode is String stationCode is String stationLatitude is degrees stationLongitude is degrees stationElevation is Meters
Method __find_arrivalTime delta is in degrees depth is in meters
Method __init__ Undocumented
Method _build Undocumented
Method _build_predefined Undocumented
Method _check_param Undocumented
Method _fill_kwargsevent Undocumented
Method _fill_kwargsstation Undocumented
Method _getOrigin Undocumented
Method _organize_by_event Undocumented
Method _organize_by_station Undocumented
Method _resolve_phasenames Undocumented
Instance Variable __include_restricted A global flag used by self._fill_kwargsstation to include or not restricted inventory.
Instance Variable __tworker Undocumented
Instance Variable _plotevents A global flag used by eventBased and stationBased to show or not events.
@staticmethod
def event_list(request, fields=['#', 'eventId', 'time', 'longitude', 'latitude', 'depth', 'magnitude'], separator='\t', formats={}, destination=sys.stdout):

Generate a printout list of individual events in the request

This method can be used to generate a print out list of the events in the request. Its output can be customized using the fields parameters. Aditionaly it also returns a list with the output that can be consumed into your program.

Parameters
request:requestThe input request
fields:listA list of fields to be reported and returned.
separator:str, default " "A character that will be used as field separator (like "," to make a csv)
formats:dict, default {}A dictionary of formats to change each field number formating.
destination:file, default sys.stdoutAn open file for destination of the print out.
Returns
listA data list including the selected fields.
@staticmethod
def filter_channels(request, allowedChannels='Z'):

Filter channels to be requested.

This method will filter OUT all channels that are not in the allowedChannels variable.

Warning

Request is filtered inplace.

Parameters
request:requestThe input request for filtering
allowedChannels:str, default "Z"A string with all allowed channel codes. Examples are: "Z", "12", "NE"
Returns
requestThe filtered request
@staticmethod
def filter_netsta(request, items, mode='N.S', operation='keep'):

Filter the request based on the items, mode and operation.

This method can be used to filter IN (operation="keep") or filter OUT (operation="remove") request lines from request based on its network/station values. The mode parameter indicate if items is a list of networks, stations of network.station values. Items is always a list.

Warning

Requests is filtered inplace.

Parameters
request:requestA request to process. This will be modified.
items:listA list of items to keep in the request.
mode:strA string to indicate the mode of operation, can be N.S, N or S to indicate Network and Stations, Network or Station.
operation:str, default "keep"A parameter to indicate if we should keep the supplied values (operation="keep", default) or remove (operation="remove") from the request.
Returns
requestThe request
@staticmethod
def filter_netStationEvent(request, existing, useNetwork=False, precision=60.0):

Filter out request lines that are already listed in the existing list.

existing is a list of (Network.Station, EventId ) tuples. Network can be ommited if useNetwork = False.

eventIds encodes event origin times, when comparing a tolerance of precision is assumed due to changes in event location between built requests.

@staticmethod
def filter_timewindow(request, start=None, end=None):

Filter out request lines not overlaping with this datetime range

This method will remove request lines from the request that do not overlap the indicated time interval. The time interval can be open to the left or right.

Warning

Requests are filtered inplace.

Parameters
request:requestThe input request to be filtered
start:str or UTCDateTime, default NoneThe start of the interval to consider. None value indicates that the interval is open to the left.
end:str or UTCDateTime, default NoneThe end of the interval to consider. None value indicates that the interval is open to the right.
Returns
requestThe filtered request
@staticmethod
def load_request(filename):

Load a request from file

Parameters
filename:strA filename to read request from
Returns
requestThe request object loaded from filename
@staticmethod
def map_request(request, add_lines=False, enhance=None, showonly=None, global_map=True, grids_on=True):

Make a map using cartopy representing the request.

It plots all individual stations and events in the request. Map can be customized from the input parameters.

Parameter

request : request
The input request to plot
add_lines : bool, default False
Show a line connecting events and stations on the request
enhance : str, default None
A list of stations ids and/or events ids to be enhanced on the map
showonly : str, default None
One eventid or one stationid to be shown.
global_map : bool, default True
Show a global map (True) or a map around stations and events (False)
grids_on : bool, default True
Enable or disable the display of grids on the map
@staticmethod
def reqlen(request):

Count the total number of lines in request

Parameters
request:requestThe request
Returns
intThe number of lines of request in request
@staticmethod
def request_stats(request):

Show some stats from the request

Parameter

request : request
The input request
@staticmethod
def save_request(filename, request, overwrite=False):

Save a built request to file

Parameters
filename:strThe filename to write to.
request:requestThe request to be written.
overwrite:bool, default TrueIf the could should overwrite the file if it exists.
@staticmethod
def show_request(request, compact=True):

Write a summary of the request to the screen

Parameters
request:requestA request
compact:bool, default TrueUse a compact mode to save space on screen
@staticmethod
def station_list(request, fields=['#', 'stationId', 'longitude', 'latitude', 'elevation'], separator='\t', formats={}, destination=sys.stdout):

Generate a printout list of individual stations in the request

This method can be used to generate a print out list of the stations in the request. Its output can be customized using the fields parameters. Aditionaly it also returns a list with the output that can be consumed into your program.

Parameters
request:requestThe input request
fields:listA list of fields to be reported and returned.
separator:str, default " "A character that will be used as field separator (like "," to make a csv)
formats:dict, default {}A dictionary of formats to change each field number formating.
destination:file, default sys.stdoutAn open file for destination of the print out.
Returns
listA data list including the selected fields.
@staticmethod
def stev_list(request, fields=['#', 'stationId', 'slongitude', 'slatitude', 'selevation', 'eventId', 'etime', 'elongitude', 'elatitude', 'edepth', 'emagnitude'], separator='\t', formats={}, destination=sys.stdout):

Generate a printout list of events and stations in the request

This method can be used to generate a print out list of the stations and events in the request. Its output can be customized using the fields parameters. Aditionaly it also returns a list with the output that can be consumed into your program.

Parameters
request:requestThe input request
fields:listA list of fields to be reported and returned.
separator:str, default " "A character that will be used as field separator (like "," to make a csv)
formats:dict, default {}A dictionary of formats to change each field number formating.
destination:file, default sys.stdoutAn open file for destination of the print out.
Returns
listA data list including the selected fields.
def setAllowRestricted(self, true_false):

Enable of disable the use of restricted station while building the request

Parameters
true_false:boolA flag to enable (true) disable (false) the use of restricted stations.
def setShowEvents(self, true_false):

Show events obtained from server before continuing to build the request.

Parameter

true_false : bool
A True or False value that will activate or disable the Show Event feature.
@staticmethod
def __x_list(data, fields, formats, validfields, formatrule, separator, destination):

Undocumented

@staticmethod
def _getChannelList(station, t0, targetsps, instcode):
def __build_event_dictionary(self, t0, originLatitude, originLongitude, originDepth, eventMagnitude):

t0 is a UTCDateTime eventLatitude is degrees eventLongitude is degrees eventDepth is in Meters

def __build_pick_dictionary(self, phase, time, slowness, main=None):

Undocumented

def __build_station_dictionary(self, networkCode, stationCode, stationLatitude, stationLongitude, stationElevation):

networkCode is String stationCode is String stationLatitude is degrees stationLongitude is degrees stationElevation is Meters

def __find_arrivalTime(self, t0, delta, depth, phase):

delta is in degrees depth is in meters

def _build(self, lines, network, station, origin, magnitude, phaselist, phasename, targetSamplingRate, allowedGainCodes, timeRange):

Undocumented

def _build_predefined(self, lines, network, station, origin, magnitude, NS, dataWindowRange):

Undocumented

def _check_param(self, t0, t1, targetSamplingRate, allowedGainCodes, timeRange, phasesOrPhaseGroup, networkStationCodes, stationRestrictionArea, eventRestrictionArea, magnitudeRange, depthRange, distanceRange):

Undocumented

def _fill_kwargsevent(self, t0, t1, eventRestrictionArea, magnitudeRange, depthRange, latitude, longitude, distanceRange):

Undocumented

def _fill_kwargsstation(self, t0, t1, stationRestrictionArea, latitude, longitude, distanceRange):

Undocumented

def _getOrigin(self, event):

Undocumented

def _organize_by_event(self, lines):

Undocumented

def _organize_by_station(self, lines):

Undocumented

def _resolve_phasenames(self, value):

Undocumented

__include_restricted =

A global flag used by self._fill_kwargsstation to include or not restricted inventory.

__tworker =

Undocumented

_plotevents =

A global flag used by eventBased and stationBased to show or not events.