5.12. catalog_to_dd

This module contains functions to convert seisan catalogue to files to hypoDD input files.

These functions will generate both a catalogue (dt.ct) file, event file (event.dat), station information file (station.dat), and a correlation oiutput file correlated every event in the catalogue with every other event to optimize the picks (dt.cc).

The correlation routine relies on obspy’s xcorr_pick_correction function from the obspy.signal.cross_correlation module. This function optimizes picks to better than sample accuracy by interpolating the correlation function and finding the maximum of this rather than the true maximum correlation value. The output from this function is stored in the dt.cc file.

Information for the station.dat file is read from SEISAN’s STATION0.HYP file

Earthquake picks and locations are taken from the catalogued s-files - these must be pre-located before entering this routine as origin times and hypocentre locations are needed for event.dat files.

copyright:Calum Chamberlain, Chet Hopp.
license:GNU Lesser General Public License, Version 3 (https://www.gnu.org/copyleft/lesser.html)
catalog_to_dd._av_weight(W1, W2)[source]

Function to convert from two seisan weights (0-4) to one hypoDD weight(0-1).

Parameters:
  • W1 (str) – Seisan input weight (0-4)
  • W2 (str) – Seisan input weight (0-4)
Returns:

str

catalog_to_dd._cc_round(num, dp)[source]

Convenience function to take a float and round it to dp padding with zeros to return a string

Parameters:
  • num (float) – Number to round
  • dp (int) – Number of decimal places to round to.
Returns:

str

catalog_to_dd._phase_to_event(event_text)[source]

Function to convert the text for one event in hypoDD phase format to event object.

Parameters:event_text (dict) – dict of two elements, header and picks, header is a str, picks is a list of str.
Returns:obspy.core.event.Event
catalog_to_dd.readSTATION0(path, stations)[source]

Function to read the STATION0.HYP file on the path given. Outputs written in station.dat file.

Parameters:
  • path (str) – Path to the STATION0.HYP file
  • station (list) – Stations to look for
Returns:

List of tuples of station, lat, long, elevation

catalog_to_dd.read_phase(ph_file)[source]

Function to read hypoDD phase files into catalog class.

Parameters:ph_file (str) – Phase file to read event info from.
Returns:obspy.core.catlog
catalog_to_dd.sfiles_to_event(sfile_list)[source]

Function to write out an event.dat file of the events

Parameters:sfile_list (list) – List of s-files to sort and put into the database
Returns:List of tuples of event ID (int) and Sfile name
catalog_to_dd.write_catalog(event_list, max_sep=1, min_link=8)[source]

Function to write the dt.ct file needed by hypoDD - takes input event list from write_event as a list of tuples of event id and sfile. It will read the pick information from the seisan formated s-file using the sfile_util utilities.

Parameters:
  • event_list (list of tuple) – List of tuples of event_id (int) and sfile (String)
  • max_sep (float) – Maximum seperation between event pairs in km
  • min_link (int) – Minimum links for an event to be paired
Returns:

list stations

Note

Currently we have not implemented a method for taking unassociated event objects and wavefiles. As such if you have events with associated wavefiles you are advised to generate Sfiles for each event using the sfile_util module prior to this step.

catalog_to_dd.write_correlations(event_list, wavbase, extract_len, pre_pick, shift_len, lowcut=1.0, highcut=10.0, max_sep=4, min_link=8, coh_thresh=0.0, coherence_weight=True, plotvar=False)[source]

Function to write a dt.cc file for hypoDD input - takes an input list of events and computes pick refienements by correlation.

Parameters:
  • event_list (list of tuple) – List of tuples of event_id (int) and sfile (String)
  • wavbase (str) – Path to the seisan wave directory that the wavefiles in the S-files are stored
  • extract_len (float) – Length in seconds to extract around the pick
  • pre_pick (float) – Time before the pick to start the correlation window
  • shift_len (float) – Time to allow pick to vary
  • lowcut (float) – Lowcut in Hz - default=1.0
  • highcut (float) – Highcut in Hz - deafult=10.0
  • max_sep (float) – Maximum seperation between event pairs in km
  • min_link (int) – Minimum links for an event to be paired
  • coherence_weight (bool) – Use coherence to weight the dt.cc file, or the raw cross-correlation value, defaults to false which uses the cross- correlation value.
  • plotvar (bool) – To show the pick-correction plots, defualts to False.

Warning

This is not a fast routine!

Warning

In contrast to seisan’s corr routine, but in accordance with the hypoDD manual, this outputs corrected differential time.

Note

Currently we have not implemented a method for taking unassociated event objects and wavefiles. As such if you have events with associated wavefiles you are advised to generate Sfiles for each event using the sfile_util module prior to this step.

catalog_to_dd.write_event(catalog)[source]

Function to write obspy.core.Catalog to a hypoDD format event.dat file.

Parameters:catalog (osbpy.core.Catalog) – A catalog of obspy events