NordicEvent

This module contains NordicEvent class and its methods.

Functions and Classes

class NordicEvent(pid='', root_pid='', creation_id=-1, solution_type='O', creation_info=<nordb.nordic.misc.CreationInfo object>)

Container object of nordic event information

Parameters:
  • main_h (array) – NordicMain objects of the NordicEvent
  • macro_h (array) – NordicMacroseismic objects of the NordicEvent
  • comment_h (array) – NordicComment objects of the NordicEvent
  • waveform_h (array) – NordicWaveform objects of the NordicEvent
  • data (array) – data array of the event
  • pid (str) – permanent ID of the event, or more like the solution, in the database
  • root_pid (str) – root permanent ID of the event
  • creation_id (int) – creation_id of the event
  • solution_type (str) – solution type of the event
Variables:

nordic_event_id (int) – id of the tuple in table nordic_event

createHelpHeaderString()

Function that returns the help header of type 7 as a string.

Header: ” STAT SP IPHASW D HRMM SECON CODA AMPLIT PERI AZIMU VELO SNR AR TRES W DIS CAZ7n” :return: The help header as a string

createNordbIdHeaderString()

Function that returns the persistent id (aka pid aka NORDBID) header as a string.

distanceFromOriginToStation(stat_code)

Function for calculating the distance between the origin on this event to a station in the database

Parameters:stat_code (string) – The station code string for the station
Returns:distance between station and event in kilometers. None if no station found
getDepth()

Get depth of the NordicEvent. Modifying this value will not modify the value inside the event.

Returns:Depth object
getHeaderString(*args)

Get only the header rows as a string. If args is defined, these will determine which header riows are appended to the string. The possible args are 1 - Main header, 2 - Macroseismic header, 3- Comment header, 5 - Error Header, 6 - Waveform Header.

Parameters:args (array) – header types which need to be printed
Returns:the header string
getLatitude()

Get latitude of the NordicEvent. Modifying this value will not modify the value inside the event.

Returns:Coordinate object
getLongitude()

Get longitude of the NordicEvent. Modifying this value will not modify the value inside the event.

Returns:Coordinate object
getMagnitude()

Get magnitude of the NordicEvent. Modifying this value will not modify the value inside the event.

Returns:Magnitude object
getOriginTime()

Get origin time of the NordicEvent. Modifying this value will not modify the value inside the event. Returns none if the event has no origin_time.

Returns:OriginTime object
getQuakeML(filepath=None)

GetQuakeML returns the nordic event as a QuakeML string or writes the event as a xml file named filepath

Parameters:filepath (str) – filepath to to the file you want to write the file. Leave empty to only return the quakeml file as a string
Returns:quakeml xml file as a string
getSC3(filepath=None)

GetSC3 returns the nordic event as a SC3-XML string or writes the event as a xml file named filepath.

Parameters:filepath (str) – filepath to to the file you want to write the file. Leave empty to only return the sc3 file as a string
Returns:SC3 xml file as a string
getStations()

Get all stations as an array that are in the data array of this event

Returns:array of Station objects
insert2DB(solution_type='O', nordic_filename=None)

Pushes an event to the database. To be used with a predefined filename. Allows many more arguments as defined in nordic_event_object_to_database function.

Parameters:
  • solution_type (str) – solution type of the event. Default is O.
  • nordic_filename (str) – name of the file that created this event. Default is None.
replaceArrivalsWithCSS(arrivals_filename, picks_filename)

Function that replaces all nordic phase data with a css arrivals file information. May also replace maximum amplitude of nordic file by that from pick file.

Parameters:
  • arrivals_filename (string) – filename of the arrivals file as a string
  • picks_filename (optional) (string) – filename of the pick file as a string
solutionsAreSimilar(nordic_event_object, latitude_window, longitude_window, magnitude_window, time_window, coordinate_unit='deg', require_all=False)

Method for comparing the similarity of self and given nordic_event_object. If all parameters are required but some cannot be found, those unfound are replaced by dummy values. This ensures that for example, two LE F solutions without location may be treated as duplicates.

Parameters:
  • nordic_event_object (NordicEvent) – Object to which self is compared
  • latitude_window (float) – Latitude window (default unit: deg)
  • longitude_window (float) – Longitude window (default unit: deg)
  • magnitude_window (float) – Magnitude window
  • time_window (float) – Time window in seconds
  • coordinate_unit (str) – Units of the lat. and long. windows, acceptable values: [‘deg’,’ km’] (default: deg)
  • require_all – If True returns True only if all windows are satisfied (default: True)
strWithoutPidHeader()

Function that returns a string that equals the __str__ representation without NORDBID header line.