Nordic

This module contains all classes surrounding the representation of events in the program. NordicEvent is the root object to which all other objects in this module refer to.

Examples:

hour = nordicData.hour
cur.execute(insert_query, nordicData.__dir__())

Functions and Classes

createNordicEvents(nordic_file, solution_type='O', location_program='')

Function for creating a finalised Array of NordicEvent objects from a python file object or the string of the filename

Parameters:
  • string nordic_file (file) – file to be read or the name of the file
  • solution_type (string) – solution type of the event
Returns:

Array of NordicEvent Objects and Array of failed Events as string

createStringCommentHeader(header)

Function that creates Nordic comment list with values being strings

Parameters:header (str) – string from where the data is parsed from
Returns:NordicComment object with a list of values parsed from header
createStringErrorHeader(header, fix_nordic, fixed_depth=None)

Function that creates Nordic error list with values being strings

Parameters:
  • header (str) – string from where the data is parsed from
  • fix_nordic (bool) – Flag for fixing some common mistakes with nordic files. See nordicFix module.
  • fixed_depth (str) – Flag for if the depth value was fixed for clearing the depth_error value
Returns:

NordicError object with a list of values parsed from header

createStringMacroseismicHeader(header)

Function that creates NordicMacroseismic list with values being strings

Parameters:header (str) – string from where the data is parsed from
Returns:NordicMacroseismic object with list of values parsed from header
createStringMainHeader(header, fix_nordic)

Function that creates NordicMain object with a list with values being strings

Parameters:
  • header (str) – string from where the data is parsed from
  • fix_nordic (bool) – Flag for fixing some common mistakes with nordic files. See nordicFix module.
Returns:

NordicMain object with list of values parsed from header

createStringPhaseData(data, fix_nordic, obs_datetime)

Function that creates Nordic phase data list with values being strings

Parameters:
  • data (str) – string from where the data is parsed from
  • fix_nordic (bool) – Flag for fixing some common mistakes with nordic files. See nordicFix module.
  • obs_datetime (obs_time) – obs_time of the first main header for creating the observation_time
Returns:

NordicData object with a list of values parsed from data

createStringWaveformHeader(header)

Function that creates Nordic waveform list with values being strings

Parameters:header (str) – string from where the data is parsed from
Returns:NordicWaveform object with a list of values parsed from header
readHeaders(event, nordic_string, fix_nordic)

Function for reading all the header files from the nordic file and returning them a header objects.

Parameters:
  • event (NordicEvent) – nordic event to which the headers will be read to
  • nordic_string (Array) – nordic file in string array form
  • fix_nordic (bool) – Flag for fixing some common mistakes with nordic files. See nordicFix module.
Returns:

amount of headers read

readNordic(nordic_string, fix_nordic=True, root_pid='', creation_id=-1, event_type='O', location_program='')

Function for creating a single NordicEvent object from a (list of) string(s).

Parameters:
  • nordic_string (Array) – Nordic file as an array of strings (only mandatory argument)
  • fix_nordic (bool) – Flag for fixing some common mistakes with nordic files. See nordicFix module.
  • root_pid (str) – Persistent ID of the root event
  • creation_id (int) – id of the creation info in the database
  • event_type (str) – Type of the event
Returns:

Nordic Event object