seismic.gps_corrections package

Submodules

seismic.gps_corrections.gps_clock_correction_gui module

GUI interface to generating clock corrections from x-corr results.

class seismic.gps_corrections.gps_clock_correction_gui.GpsClockCorrectionApp(master=None)[source]

Bases: tkinter.Frame

Construct a frame widget with the parent MASTER.

Valid resource names: background, bd, bg, borderwidth, class, colormap, container, cursor, height, highlightbackground, highlightcolor, highlightthickness, relief, takefocus, visual, width.

busy()[source]
not_busy()[source]
class seismic.gps_corrections.gps_clock_correction_gui.SplineDegreeWidget(index, initial_value, master=None, command=None)[source]

Bases: tkinter.LabelFrame

Construct a labelframe widget with the parent MASTER.

STANDARD OPTIONS

borderwidth, cursor, font, foreground, highlightbackground, highlightcolor, highlightthickness, padx, pady, relief, takefocus, text

WIDGET-SPECIFIC OPTIONS

background, class, colormap, container, height, labelanchor, labelwidget, visual, width

property is_enabled
property spline_degree

seismic.gps_corrections.picks_reader_utils module

Functions to read picks from custom csv file into Pandas DataFrame format and related data filtering utilities.

seismic.gps_corrections.picks_reader_utils.compute_matching_network_mask(df, net_dict)[source]

Compute the mask for df of network codes and station codes that match the sequence specified in net_dict.

This function differs from pandas.DataFrame.isin() function in that it only matches net.sta pairs from the same index in the ‘net’ and ‘sta’ lists from net_dict, whereas isin() matches net.sta pairs from arbitrary different positions in the lists.

Parameters
  • df (pandas.DataFrame) – Pandas dataframe loaded from a pick event ensemble

  • net_dict (dict of corresponding network and station codes under keys 'net' and 'sta' respectively.) – Lists of corresponding network and station codes to match pariwise against columns ‘net and ‘sta’.

Returns

Row mask for df haev value True in rows whose [‘net’, ‘sta’] columns match one of the (‘net’, ‘sta’) pairs generated from net_dict.

Return type

numpy.array(bool)

seismic.gps_corrections.picks_reader_utils.generate_large_events_catalog(df_picks, min_magnitude=8.0, min_record_count=400, label_historical_events=True)[source]

Use input picks dataset to identify dates of large seismic events

Parameters
  • df_picks (pandas.DataFrame) – Dataframe of picks data following PICKS_TABLE_SCHEMA

  • min_magnitude (float, optional) – Minimum seismic magnitude to be considered ‘large’ event, defaults to 8.0

  • min_record_count (int, optional) – Minimum number of records per day required with magnitude >= min_magnitude to be included in the event catalog, defaults to 400

  • label_historical_events (bool, optional) – Whether to populate fixed list of known historical events, defaults to True

Returns

Dataframe of large seismic events indexed by date.

Return type

pandas.DataFrame

seismic.gps_corrections.picks_reader_utils.get_network_date_range(df, netcode)[source]

Get the date range of pick events in df for a given network code

Parameters
  • df (pandas.DataFrame) – Pandas dataframe loaded from a pick event ensemble

  • netcode (str) – Network code whose pick event dates min and max will be returned

Returns

Min and max dates of picks for given network

Return type

tuple(obspy.UTCDateTime, obspy.UTCDateTime)

seismic.gps_corrections.picks_reader_utils.get_network_location_mean(df, netcode)[source]

Get the mean station latitude and longitude coordinates for all stations in a given network.

Parameters
  • df (pandas.DataFrame) – Pandas dataframe loaded from a pick event ensemble

  • netcode (str) – Network code for which mean coordinates will be returned

Returns

Mean (latitude, longitude) coordinates of stations in the network

Return type

tuple(float, float)

seismic.gps_corrections.picks_reader_utils.get_network_stations(df, netcode)[source]

Get the unique station codes belonging to a given network from a Pandas DataFrame

Parameters
  • df (pandas.DataFrame) – Pandas dataframe loaded from a pick event ensemble

  • netcode (str) – Network code for which station codes will be returned

Returns

Sorted list of station code strings extracted from df

Return type

list(str)

seismic.gps_corrections.picks_reader_utils.get_overlapping_date_range(df, network_1, network_2)[source]

Get the range of dates for which pick events in df from network_1 set of stations overlap with any picks from network_2 set of stations.

Parameters
  • df (pandas.DataFrame) – Pandas dataframe loaded from a pick event ensemble

  • network_1 (dict of corresponding network and station codes under keys 'net' and 'sta') – Network and station codes for first network

  • network_2 (dict of corresponding network and station codes under keys 'net' and 'sta') – Network and station codes for second network

Returns

Start and end dates of datetime range during which pick events overlap for network_1 and network_2

Return type

tuple(obspy.UTCDateTime, obspy.UTCDateTime)

seismic.gps_corrections.picks_reader_utils.get_station_date_range(df, netcode, statcode)[source]

Get the date range of pick events in df for a given network and station code

Parameters
  • df (pandas.DataFrame) – Pandas dataframe loaded from a pick event ensemble

  • netcode (str) – Network code

  • statcode (str) – Station code

Returns

Min and max dates of picks for given network and station

Return type

tuple(obspy.UTCDateTime, obspy.UTCDateTime)

seismic.gps_corrections.picks_reader_utils.read_picks_ensemble(csv_file)[source]

Read picks from CSV file using PICKS_TABLE_SCHEMA and return as a Pandas DataFrame.

Parameters

csv_file (str or path) – Input file containing picks ensemble

Returns

Pandas dataframe containing picks data

Return type

pandas.DataFrame

seismic.gps_corrections.relative_tt_residuals_plotter module

Bulk analysis script for analysing relative traveltime residuals from a pick ensemble for the purpose of identifying time periods of GPS clock error in specific stations.

Example usage, which plots 7X.MA11 and 7X.MA12 residuals relative to all common events on AU network:

relative_tt_residuals_plotter.py --network1=AU --networks2=7X --stations2="MA11,MA12" /c/data_cache/Picks/20190320/ensemble.p.txt
class seismic.gps_corrections.relative_tt_residuals_plotter.BatchOptions[source]

Bases: object

Simple container type for run time options.

class seismic.gps_corrections.relative_tt_residuals_plotter.DisplayOptions[source]

Bases: object

Simple container type for display options.

class seismic.gps_corrections.relative_tt_residuals_plotter.FilterOptions[source]

Bases: object

Simple container type for filtering options.

seismic.gps_corrections.relative_tt_residuals_plotter.analyze_target_relative_to_ref(df_picks, ref_stn, target_stns, filter_options)[source]

Analyze a single (reference) station’s residuals relative to all the other stations in a (target) network.

Parameters
  • df_picks (pandas.DataFrame) – Pandas dataframe loaded from a pick event ensemble

  • ref_stn (dict of corresponding network and station codes under keys 'net' and 'sta' (expected to be just one entry)) – Network and station codes for reference network (expected to be just one entry)

  • target_stns (dict of corresponding network and station codes under keys 'net' and 'sta') – Network and station codes for target network

  • filter_options (class FilterOptions) – Filter options.

Returns

Dataframe with filtering applied and reference residual populated ready for plotting.

Return type

pandas.DataFrame

seismic.gps_corrections.relative_tt_residuals_plotter.apply_event_quality_filtering(df, ref_stn, filter_options)[source]

Apply event quality requirements to pick events. The event magnitude threshold is only used to filter rows where the quality metrics [‘snr’, ‘qualityMeasureCWT’, ‘qualityMeasureSlope’, ‘nSigma’] are all zero.

Parameters
  • df (pandas.DataFrame) – Pandas dataframe loaded from a pick event ensemble

  • ref_stn (dict of corresponding network and station codes under keys 'net' and 'sta' (expected to be just one entry)) – Network and station codes for reference network (expected to be just one entry)

  • filter_options (class FilterOptions) – Filter options.

Returns

Filtered dataframe of pick events

Return type

pandas.DataFrame

seismic.gps_corrections.relative_tt_residuals_plotter.broadcast_ref_residual_per_event(df_plot, ref_netcode, ref_stacode, filter_options)[source]

For each event in the dataframe, figure out the best reference residual and add it to new column ‘ttResidualRef’

Parameters
  • df (pandas.DataFrame) – Pandas dataframe loaded from a pick event ensemble

  • ref_netcode (str) – The reference network code

  • ref_stacode (str) – The reference station code

  • filter_options (class FilterOptions) – Filter options.

Returns

Dataframe with a consistent reference residual populated for each event for given reference station.

Return type

pandas.DataFrame

seismic.gps_corrections.relative_tt_residuals_plotter.determine_alternate_matching_codes(df, iris_file, original_network)[source]

Find stations from other networks in df with the same station codes, but different network codes, whose positions match the stations of the same code in the original network.

Parameters
  • df (pandas.DataFrame) – Pandas dataframe loaded from a pick event ensemble

  • iris_file (str or path) – IRIS catalog query result file containing network and station information in stationtxt format

  • original_network (str) – Network code whose station codes will be extracted from IRIS file

Returns

Matching sequences of network and station codes

Return type

tuple(str), tuple(str)

seismic.gps_corrections.relative_tt_residuals_plotter.filter_duplicated_network_codes(df_picks)[source]

Filter picks dataframe to remove records for selected known duplicate network codes based on date of the records we want to keep.

Parameters

df_picks (pandas.DataFrame) – Picks dataframe to filter

Returns

Filtered picks dataframe with unwanted records removed.

Return type

pandas.DataFrame

seismic.gps_corrections.relative_tt_residuals_plotter.filter_limit_channels(df_picks, channel_pref)[source]

Filter picks dataframe to a limited range of preferred channel types.

Parameters

df_picks (pandas.DataFrame) – Picks dataframe to filter

Returns

Filtered picks dataframe with only preferred channels

Return type

pandas.DataFrame

seismic.gps_corrections.relative_tt_residuals_plotter.filter_to_teleseismic(df_picks, min_dist_deg, max_dist_deg)[source]

Filter picks dataframe to limited range of teleseismic distances of the original events.

Parameters
  • df_picks (pandas.DataFrame) – Picks dataframe to filter

  • min_dist_deg (float) – Minimum teleseismic distance (degrees)

  • max_dist_deg (float) – Maximum teleseismic distance (degrees)

Returns

Filtered picks dataframe containing only events with limited range of teleseismic distance.

Return type

pandas.DataFrame

seismic.gps_corrections.relative_tt_residuals_plotter.get_iris_station_codes(src_file, original_network)[source]

Extract the station codes for a given network code from a IRIS query result file.

Parameters
  • src_file (str or path) – IRIS catalog query result file containing network and station information, in stationtxt format

  • original_network (str) – Network code whose station codes will be extracted from IRIS file

Returns

Pandas dataframe with station codes as the index and station latitude, longitude as columns

Return type

pandas.DataFrame

seismic.gps_corrections.relative_tt_residuals_plotter.pandas_timestamp_to_plottable_datetime(data)[source]

Convert float UTC timestamp to equivalent type that is plottable by matplotlib

Parameters

data (pandas.Series) – Pandas series of float timestamps

Returns

Array of Python datetimes

Return type

numpy.array(datetime)

seismic.gps_corrections.relative_tt_residuals_plotter.utc_time_string_to_plottable_datetime(utc_timestamp_str)[source]

Convert a UTC timestamp string to datetime type that is plottable by matplotlib

Parameters

utc_timestamp_str (str) – ISO-8601 UTC timestamp string

Returns

Plottable datetime value

Return type

datetime.datetime with tzinfo

Module contents