SeisCat API

Start here to navigate the SeisCat source code.

seiscat CLI

Main script for seiscat.

copyright:

2022-2026 Claudio Satriano <satriano@ipgp.fr>

license:

GNU General Public License v3.0 or later (https://www.gnu.org/licenses/gpl-3.0-standalone.html)

seiscat.main.main()[source]

Main function. Catch KeyboardInterrupt.

seiscat.main.run()[source]

Run seiscat.

Run a user-defined command on a list of events.

copyright:

2022-2026 Claudio Satriano <satriano@ipgp.fr>

license:

GNU General Public License v3.0 or later (https://www.gnu.org/licenses/gpl-3.0-standalone.html)

seiscat.run_command.run_command(config)[source]

Execute a user-defined command for each event stored in the database.

The command can be a shell script or executable. On Windows, the function automatically detects and uses the appropriate interpreter based on the file extension:

  • .ps1 → PowerShell

  • .py → Python

  • .bat / .cmd → CMD shell

On Unix-like systems (Linux/macOS), the command is executed directly through the system shell. For each event, all event fields are exported as environment variables, allowing scripts to access event data.

Database access supports concurrent processes, enabling multiple instances to modify the database safely while commands are being run.

Parameters:

config (dict) – Configuration object

Self Management

Self-management command namespace for SeisCat.

Dispatcher for seiscat self command group.

seiscat.self.commands.run_self_command(args)[source]

Dispatch seiscat self … commands.

Status command for seiscat self.

seiscat.self.status.get_self_status()[source]

Return status dictionary for seiscat self status output.

seiscat.self.status.print_self_status()[source]

Print status report for seiscat self status command.

Update logic for seiscat self commands.

seiscat.self.update.get_latest_release_version(timeout=5)[source]

Return latest release version from PyPI, or None on failure.

seiscat.self.update.uninstall_seiscat(yes=False)[source]

Uninstall SeisCat from current environment/tool backend.

seiscat.self.update.update_seiscat(git=False)[source]

Update SeisCat using release or git policy.

Returns a user-facing status string.

Shell completion helpers for seiscat self commands.

seiscat.self.completion.completion_status()[source]

Return completion status dictionary for current platform/shell.

seiscat.self.completion.install_completion()[source]

Install shell completion for current shell with best-effort fallback.

seiscat.self.completion.uninstall_completion()[source]

Remove managed completion snippets/lines.

Install-context detection for seiscat self commands.

class seiscat.self.install_detection.InstallContext(installer: str, channel: str, version_installed: str, source_url: str | None, editable: bool, confidence: str)[source]

Bases: object

Detected install context for SeisCat.

channel: str
confidence: str
editable: bool
installer: str
source_url: str | None
version_installed: str
seiscat.self.install_detection.detect_install_context(dist_name='seiscat')[source]

Detect installer/channel metadata for the installed distribution.

Print the beautiful ascii-art seiscat logo.

seiscat.self.logo.print_logo_small()[source]

Print the compact seiscat logo.

Export

Export functions for seiscat.

copyright:

2022-2026 Claudio Satriano <satriano@ipgp.fr>

license:

GNU General Public License v3.0 or later (https://www.gnu.org/licenses/gpl-3.0-standalone.html)

seiscat.export.export_catalog(config)[source]

Export catalog.

Parameters:

config – config object

Database

Database functions for seiscat.

copyright:

2022-2026 Claudio Satriano <satriano@ipgp.fr>

license:

GNU General Public License v3.0 or later (https://www.gnu.org/licenses/gpl-3.0-standalone.html)

seiscat.database.dbfunctions.add_column_to_db(config, column_definition)[source]

Add a new column to the events table.

seiscat.database.dbfunctions.backup_db(config, move=False)[source]

Create a backup of the current database file.

Parameters:
  • config – config object

  • move – if True, move db file to backup path. If False, copy it.

Returns:

backup file path

Raises:
  • ValueError – if db_file is not set in config file

  • FileNotFoundError – if database file does not exist

seiscat.database.dbfunctions.check_db_exists(config, initdb)[source]

Check if database file exists.

Parameters:
  • config – config object

  • initdb – if True, create new database file

Raises:
  • ValueError – if db_file is not set in config file

  • RuntimeError – if user does not want to overwrite existing database

  • FileNotFoundError – if database file does not exist

seiscat.database.dbfunctions.delete_column_from_db(config, column_name)[source]

Delete a column from the events table.

seiscat.database.dbfunctions.delete_event_from_db(config, eventid, version=None)[source]

Delete an event from the database.

Parameters:
  • config – config object

  • eventid – event id of the event to delete (if None, delete all events for the given version)

  • version – version of the event to delete (if None, delete all versions of the event)

seiscat.database.dbfunctions.get_catalog_stats(config)[source]

Get a string with catalog statistics.

Parameters:

config – config object

Returns:

string with catalog statistics

seiscat.database.dbfunctions.get_db_columns(config)[source]

Return the list of column names in the events table.

seiscat.database.dbfunctions.increment_event_in_db(config, eventid, version, field, value)[source]

Increment an event in the database.

Parameters:
  • config – config object

  • eventid – event id of the event to update

  • version – version of the event to update

  • field – field to update

  • value – value to increment, must be a number

Raises:

ValueError – if field is not found in database, or if value is not a number

seiscat.database.dbfunctions.read_events_from_db(config, eventid=None, version=None)[source]

Read events from database. Return a list of events.

Parameters:
  • config – config object

  • eventid – limit to events with this evid

  • version – limit to events with this version

Returns:

list of events, each event is a dictionary-like object

seiscat.database.dbfunctions.read_evids_and_versions_from_db(config)[source]

Get a list of event ids and versions from the database.

This function only onors the allversions option but not the where option.

Parameters:

config – config object

Returns:

list of tuples (evid, version)

seiscat.database.dbfunctions.read_fields_and_rows_from_db(config, eventid=None, version=None, field_list=None, honor_where_filter=True, honor_sortby=True, honor_reverse=True)[source]

Read fields and rows from database. Return a list of fields and a list of rows. The rows are sorted by time and version.

Parameters:
  • config – config object

  • eventid – limit to events with this evid. If None, then the eventid is taken from the command line arguments via config['args']

  • version – limit to events with this version. If None, then the version is taken from the command line arguments via config['args']

  • field_list – list of fields to read from the database

  • honor_where_filter – if True, honor the where option

  • honor_sortby – if True, honor the sortby option

  • honor_reverse – if True, honor the reverse option

Returns:

list of fields, list of rows

Raises:

ValueError – if field is not found in database

seiscat.database.dbfunctions.rename_column_in_db(config, rename_definition)[source]

Rename a column in the events table using OLD=NEW syntax.

seiscat.database.dbfunctions.replicate_event_in_db(config, eventid, version=1)[source]

Replicate an event in the database. The new event will have the same evid as the original event, but a different version.

Parameters:
  • config – config object

  • eventid – event id of the original event

  • version – version of the original event

Raises:

ValueError – if eventid/version is not found in database

seiscat.database.dbfunctions.update_event_in_db(config, eventid, version, field, value)[source]

Update an event in the database.

Parameters:
  • config – config object

  • eventid – event id of the event to update

  • version – version of the event to update

  • field – field to update

  • value – new value

Raises:

ValueError – if field is not found in database

seiscat.database.dbfunctions.write_catalog_to_db(cat, config, initdb)[source]

Write catalog to database.

Parameters:
  • cat – obspy Catalog object

  • config – config object

  • initdb – if True, create new database file

Feed the database with events from a file or FDSN web services.

copyright:

2022-2026 Claudio Satriano <satriano@ipgp.fr>

license:

GNU General Public License v3.0 or later (https://www.gnu.org/licenses/gpl-3.0-standalone.html)

seiscat.database.feeddb.feeddb(config, initdb)[source]

Feed the database with events from file(s) (CSV or any ObsPy-supported format) or FDSN web services.

Multiple files can be provided with –fromfile and will be merged into a single catalog before writing to the database.

Parameters:
  • config – config object

  • initdb – if True, create new database file

Crop functions for seiscat.

copyright:

2022-2026 Claudio Satriano <satriano@ipgp.fr>

license:

GNU General Public License v3.0 or later (https://www.gnu.org/licenses/gpl-3.0-standalone.html)

seiscat.database.cropdb.cropdb(config)[source]

Crop the existing database to the selection criteria defined in config.

A backup of the database is created before any changes are made. Events that do not match any of the geographic, depth, magnitude and event-type criteria defined in the configuration are deleted.

Parameters:

config – config object

seiscat.database.cropdb.filter_catalog_by_config(cat, config)[source]

Filter an ObsPy Catalog according to the selection criteria in config.

Only geographic (box or circle), depth, magnitude and event type criteria are evaluated; time-range criteria are ignored because the caller is responsible for time filtering when reading from file.

Parameters:
  • cat – obspy Catalog object

  • config – config object

Returns:

filtered obspy Catalog object

Edit functions for seiscat.

copyright:

2022-2026 Claudio Satriano <satriano@ipgp.fr>

license:

GNU General Public License v3.0 or later (https://www.gnu.org/licenses/gpl-3.0-standalone.html)

seiscat.database.editdb.editdb(config)[source]

Edit database.

Parameters:

config – config object

Get or set the value of a specific event attribute

copyright:

2022-2026 Claudio Satriano <satriano@ipgp.fr>

license:

GNU General Public License v3.0 or later (https://www.gnu.org/licenses/gpl-3.0-standalone.html)

seiscat.database.get_set.seiscat_get(config)[source]

Get the value of a specific event attribute

seiscat.database.get_set.seiscat_set(config)[source]

Set the value of a specific event attribute

Event data types for seiscat.

copyright:

2022-2026 Claudio Satriano <satriano@ipgp.fr>

license:

GNU General Public License v3.0 or later (https://www.gnu.org/licenses/gpl-3.0-standalone.html)

class seiscat.database.data_types.Event(*args, **kwargs)[source]

Bases: dict

A custom dictionary class that supports sorting events based on keys and is hashable based on evid and ver.

class seiscat.database.data_types.EventList(iterable=(), /)[source]

Bases: list

A custom list class that supports sorting events based on keys.

sort(key=None, reverse=False)[source]

Sort events by a given key.

Parameters:
  • key – function to sort events

  • reverse – if True, sort in reverse

Transient terminal status helpers.

copyright:

2022-2026 Claudio Satriano <satriano@ipgp.fr>

license:

GNU General Public License v3.0 or later (https://www.gnu.org/licenses/gpl-3.0-standalone.html)

seiscat.database.transient_status.transient_status(initial_message)[source]

Show a transient status line on stderr and clear it on exit.

Yields an update callable to change the message while active.

Fetching Data

Download event details from FDSN web services and store them to local files.

copyright:

2022-2026 Claudio Satriano <satriano@ipgp.fr>

license:

GNU General Public License v3.0 or later (https://www.gnu.org/licenses/gpl-3.0-standalone.html)

seiscat.fetchdata.event_details.fetch_event_details(config)[source]

Fetch event details from FDSN web services and store them to local files.

Parameters:

config – config object

Fetch event waveforms from FDSN web services or from a local SDS archive.

copyright:

2022-2026 Claudio Satriano <satriano@ipgp.fr>

license:

GNU General Public License v3.0 or later (https://www.gnu.org/licenses/gpl-3.0-standalone.html)

seiscat.fetchdata.event_waveforms.fetch_event_waveforms(config)[source]

Fetch event waveforms from FDSN web services or from a local SDS archive.

Parameters:

config – config object

Uses ObsPy mass downloader to download event waveforms from FDSN web services.

copyright:

2022-2026 Claudio Satriano <satriano@ipgp.fr>

license:

GNU General Public License v3.0 or later (https://www.gnu.org/licenses/gpl-3.0-standalone.html)

seiscat.fetchdata.event_waveforms_utils.check_station(station, station_codes)[source]

Check if a station matches the specified station codes. The station codes can contain wildcards: - ‘*’ matches any number of characters - ‘?’ matches a single character

Parameters:
  • station (str) – station code

  • station_codes (str) – string with station codes separated by commas

Returns:

True if the station matches one of the specified patterns

Return type:

bool

seiscat.fetchdata.event_waveforms_utils.get_picked_station_codes(evid_dir, evid)[source]

Read the event QuakeML file and return the set of station codes that have at least one P or S-wave pick.

Parameters:
  • evid_dir (pathlib.Path) – path to the event directory

  • evid (str) – event ID

Returns:

set of station codes with picks, or None if the file is not found

Return type:

set or None

seiscat.fetchdata.event_waveforms_utils.prefer_high_sampling_rate(waveform_dir, logger=None)[source]

Remove low sampling rate files from the waveform directory.”

Parameters:
  • waveform_dir (str) – path to the waveform directory

  • logger (logging.Logger) – logger object

Uses ObsPy mass downloader to download event waveforms from FDSN web services.

copyright:

2022-2026 Claudio Satriano <satriano@ipgp.fr>

license:

GNU General Public License v3.0 or later (https://www.gnu.org/licenses/gpl-3.0-standalone.html)

seiscat.fetchdata.mass_downloader.mass_download_waveforms(config, event)[source]

Download waveforms for a single event using ObsPy mass downloader.

Parameters:
  • config – config object

  • event – event object

Fetch event waveforms from a local SDS archive.

copyright:

2022-2026 Claudio Satriano <satriano@ipgp.fr>

license:

GNU General Public License v3.0 or later (https://www.gnu.org/licenses/gpl-3.0-standalone.html)

seiscat.fetchdata.sds.fetch_sds_waveforms(config, event, client)[source]

Fetch event waveforms from a local SDS archive.

Parameters:
  • config (dict) – config object

  • event (dict) – an event dictionary

  • client (obspy.clients.filesystem.sds.Client) – SDS client

seiscat.fetchdata.sds.get_sds_client(sds_root)[source]

Get an SDS client.

Parameters:

sds_root (str) – path to SDS archive

Returns:

SDS client

Return type:

obspy.clients.filesystem.sds.Client

Sources

FDSN webservices functions for seiscat.

copyright:

2022-2026 Claudio Satriano <satriano@ipgp.fr>

license:

GNU General Public License v3.0 or later (https://www.gnu.org/licenses/gpl-3.0-standalone.html)

exception seiscat.sources.fdsnws.InvalidQuery[source]

Bases: Exception

Invalid query exception.

class seiscat.sources.fdsnws.QueryArgs(config, suffix, first_query)[source]

Bases: object

Build query arguments for FDSN client.

get_query()[source]

Return query arguments as a dictionary.

Returns:

dictionary of query arguments

seiscat.sources.fdsnws.open_fdsn_connection(config)[source]

Open FDSN connection. Return a FDSN client object.

Parameters:

config – config object

Returns:

FDSN client object

seiscat.sources.fdsnws.query_events(client, config, first_query=True)[source]

Query events from FDSN client based on criteria in config.

Parameters:
  • client – FDSN client object

  • config – config object

  • first_query – True if this is the first query

Returns:

obspy Catalog object

Read an event catalog from a CSV file.

This code is modified from Requake (https://github.com/SeismicSource/requake)

copyright:

2021-2026 Claudio Satriano <satriano@ipgp.fr>

license:

GNU General Public License v3.0 or later (https://www.gnu.org/licenses/gpl-3.0-standalone.html)

seiscat.sources.csv.read_catalog_from_csv(config, filename=None)[source]

Read a catalog from a CSV file.

Parameters:
  • config (dict) – configuration object

  • filename (str or None) – CSV filename (if None, uses args.fromfile[0])

Returns:

an ObsPy catalog object

Return type:

obspy.Catalog

Raises:
  • FileNotFoundError – if filename does not exist

  • ValueError – if depth units are invalid or file is not CSV-like or no origin time field is found

Read an event catalog from any file format supported by ObsPy.

This module reads event files using obspy.read_events(), which supports multiple formats including QuakeML, SC3ML, NLLOC, etc.

copyright:

2021-2026 Claudio Satriano <satriano@ipgp.fr>

license:

GNU General Public License v3.0 or later (https://www.gnu.org/licenses/gpl-3.0-standalone.html)

seiscat.sources.obspy_events.read_catalog_from_obspy_events(config, filename=None)[source]

Read a catalog from an event file using obspy.read_events().

Uses ObsPy’s format auto-detection for supported formats.

Parameters:
  • config (dict) – configuration object

  • filename (str or None) – event filename (if None, uses args.fromfile[0])

Returns:

an ObsPy catalog object

Return type:

obspy.Catalog

Raises:
  • FileNotFoundError – if filename does not exist

  • Exception – if file cannot be read by ObsPy

Evid generation functions for seiscat.

copyright:

2022-2026 Claudio Satriano <satriano@ipgp.fr>

license:

GNU General Public License v3.0 or later (https://www.gnu.org/licenses/gpl-3.0-standalone.html)

seiscat.sources.evid.generate_evid(orig_time)[source]

Generate an event id from origin time.

Parameters:

orig_time (obspy.UTCDateTime) – origin time

Returns:

an event id

Return type:

str

parse_arguments

Argument parsing for seiscat.

copyright:

2022-2026 Claudio Satriano <satriano@ipgp.fr>

license:

GNU General Public License v3.0 or later (https://www.gnu.org/licenses/gpl-3.0-standalone.html)

class seiscat.config.parse_arguments.CustomArgumentParser(prog=None, usage=None, description=None, epilog=None, parents=[], formatter_class=<class 'argparse.HelpFormatter'>, prefix_chars='-', fromfile_prefix_chars=None, argument_default=None, conflict_handler='error', add_help=True, allow_abbrev=True, exit_on_error=True)[source]

Bases: ArgumentParser

Custom parser that adds helpful hints to error messages.

error(message: string)[source]

Prints a usage message incorporating the message to stderr and exits.

If you override this in a subclass, it should not return – it should either exit or raise an exception.

class seiscat.config.parse_arguments.SubcommandHelpFormatter(*args: Any, **kwargs: Any)[source]

Bases: RichHelpFormatter

Custom help formatter that removes the list of subcommands from the help message.

See: https://stackoverflow.com/a/13429281/2021880

class seiscat.config.parse_arguments.WhereHelpAction(option_strings, dest, **kwargs)[source]

Bases: Action

Custom action for –where-help that displays detailed help and exits.

seiscat.config.parse_arguments.parse_arguments()[source]

Parse command line arguments.

seiscat.config.parse_arguments.print_where_help_and_exit()[source]

Print detailed help for the –where option and exit.

autocompletion

Autocompletion helpers for CLI arguments.

copyright:

2022-2026 Claudio Satriano <satriano@ipgp.fr>

license:

GNU General Public License v3.0 or later (https://www.gnu.org/licenses/gpl-3.0-standalone.html)

seiscat.config.autocompletion.colormap_completer(prefix, _parsed_args, **_kwargs)[source]

Completer for Matplotlib colormap names.

seiscat.config.autocompletion.evid_completer(prefix, parsed_args, **_kwargs)[source]

Completer for event IDs.

Parameters:
  • prefix – prefix to complete

  • parsed_args – parsed arguments

  • kwargs – keyword arguments

Returns:

list of event IDs

seiscat.config.autocompletion.sortby_completer(prefix, parsed_args, **_kwargs)[source]

Completer for sortby field names.

Parameters:
  • prefix – prefix to complete

  • parsed_args – parsed arguments

  • kwargs – keyword arguments

Returns:

list of field names

Configuration functions for seiscat.

copyright:

2022-2026 Claudio Satriano <satriano@ipgp.fr>

license:

GNU General Public License v3.0 or later (https://www.gnu.org/licenses/gpl-3.0-standalone.html)

seiscat.config.config.parse_configspec()[source]

Parse the configspec file.

Returns:

configspec object

seiscat.config.config.read_config(config_file, configspec=None)[source]

Read a config file.

Parameters:
  • config_file – path to the config file

  • configspec – configspec object

Returns:

config object

seiscat.config.config.write_sample_config(configspec, progname)[source]

Write a sample config file.

Parameters:
  • configspec – configspec object

  • progname – program name

plot_map

Plot events on a map.

copyright:

2022-2026 Claudio Satriano <satriano@ipgp.fr>

license:

GNU General Public License v3.0 or later (https://www.gnu.org/licenses/gpl-3.0-standalone.html)

seiscat.plot.plot_map.plot_catalog_map(config)[source]

Plot the catalog map.

Parameters:

config – config object

plot_utils

Utility functions shared by map and timeline plot modules.

copyright:

2022-2026 Claudio Satriano <satriano@ipgp.fr>

license:

GNU General Public License v3.0 or later (https://www.gnu.org/licenses/gpl-3.0-standalone.html)

seiscat.plot.plot_utils.filter_events_for_plotting(events, backend_name=None, require_depth=False)[source]

Filter out events with missing plot-critical coordinates or depth.

Parameters:
  • events (list) – list of events, each event is a dictionary

  • backend_name (str or None) – backend label to include in skip messages

  • require_depth (bool) – if True, also require a defined depth value

Returns:

filtered events

Return type:

list

seiscat.plot.plot_utils.format_epoch_seconds(value, multiline=False)[source]

Format Unix seconds to a compact UTC datetime label.

seiscat.plot.plot_utils.get_colormap_hex_colors(colormap_name=None, samples=16)[source]

Return evenly sampled hex colors from a Matplotlib colormap.

seiscat.plot.plot_utils.get_event_color_values(events, colorby)[source]

Get numeric color values for events based on a named attribute.

Parameters:
  • events (list) – list of events, each event is a dictionary

  • colorby (str or None) – attribute name to use for color, or None

Returns:

list of floats (one per event) or None if colorby is None, not found in events, or has no numeric values

Return type:

list of float or None

seiscat.plot.plot_utils.get_event_identifier(event)[source]

Return a compact identifier for skip messages.

seiscat.plot.plot_utils.get_event_popup_html(event)[source]

Build a popup/hover HTML string with all event fields.

seiscat.plot.plot_utils.get_label_for_attribute(attribute)[source]

Return a human-readable label for a known event attribute.

seiscat.plot.plot_utils.get_matplotlib_colormap(colormap_name=None)[source]

Return a validated Matplotlib colormap object.

Parameters:

colormap_name (str or None) – Matplotlib colormap name, or None

Returns:

(name, cmap) tuple

Return type:

tuple

seiscat.plot.plot_utils.get_plotly_colorscale(colormap_name=None, samples=16)[source]

Return a Plotly colorscale sampled from a Matplotlib colormap.

seiscat.plot.plot_utils.get_plotly_time_colorbar_kwargs(values)[source]

Return Plotly colorbar kwargs for numeric epoch-second values.

seiscat.plot.plot_utils.get_time_colorbar_ticks(values, multiline=False)[source]

Return evenly spaced tick values and datetime labels for time scales.

seiscat.plot.plot_utils.is_large_n_plotly_mode(n_events, threshold=10000)[source]

Return True when plotly should use large-N optimizations.

seiscat.plot.plot_utils.to_finite_float(value)[source]

Convert value to float, returning None for missing/non-finite values.

plot_map_utils

Utility functions for the map modules.

copyright:

2022-2026 Claudio Satriano <satriano@ipgp.fr>

license:

GNU General Public License v3.0 or later (https://www.gnu.org/licenses/gpl-3.0-standalone.html)

seiscat.plot.plot_map_utils.get_map_extent(events, config)[source]

Get the map extent from the config file.

Parameters:
  • events (list) – list of events

  • config (dict) – config object

Returns:

lon_min, lon_max, lat_min, lat_max

Return type:

tuple of float

seiscat.plot.plot_map_utils.get_map_extent_from_events(events)[source]

Get the map extent from the events.

Parameters:

events (list) – list of events

Returns:

lon_min, lon_max, lat_min, lat_max

Return type:

tuple of float

plot_map_cartopy

plot_map_folium

Plot events on a map using folium.

copyright:

2022-2026 Claudio Satriano <satriano@ipgp.fr>

license:

GNU General Public License v3.0 or later (https://www.gnu.org/licenses/gpl-3.0-standalone.html)

seiscat.plot.plot_map_folium.plot_catalog_map_with_folium(events, config)[source]

Plot the catalog map with folium.

Parameters:
  • events (list) – list of events, each event is a dictionary

  • config (configspec.ConfigObj) – config object

plot_map_plotly

Plot events in 3D using Plotly.

copyright:

2022-2026 Claudio Satriano <satriano@ipgp.fr>

license:

GNU General Public License v3.0 or later (https://www.gnu.org/licenses/gpl-3.0-standalone.html)

seiscat.plot.plot_map_plotly.plot_catalog_map_with_plotly(events, config)[source]

Plot the catalog map using plotly

Parameters:
  • events (list) – list of events, each event is a dictionary

  • config (configspec.ConfigObj) – config object

plot_timeline

Plot catalog timeline — backend dispatcher.

copyright:

2022-2026 Claudio Satriano <satriano@ipgp.fr>

license:

GNU General Public License v3.0 or later (https://www.gnu.org/licenses/gpl-3.0-standalone.html)

seiscat.plot.plot_timeline.plot_catalog_timeline(config)[source]

Plot the catalog timeline.

Reads events from the database and dispatches to the appropriate backend (matplotlib, plotly, or terminal) as specified by args.backend.

Parameters:

config – config object

plot_timeline_utils

Common utility functions for timeline plotting.

copyright:

2022-2026 Claudio Satriano <satriano@ipgp.fr>

license:

GNU General Public License v3.0 or later (https://www.gnu.org/licenses/gpl-3.0-standalone.html)

seiscat.plot.plot_timeline_utils.bin_events_by_time(events, bins_spec=None)[source]

Bin events into time intervals and count events in each bin.

Parameters:
  • events – EventList of Event dicts

  • bins_spec

    bin specification. One of:

    • None / 'auto': automatic bin width

    • integer string (e.g. '20'): that many equal-width bins

    • duration string (e.g. '7d', '1m'): fixed bin width

Returns:

list of (bin_start, bin_end, count) tuples where bin_start and bin_end are timezone-aware datetimes and count is an int.

seiscat.plot.plot_timeline_utils.bin_label(bin_start, bin_end)[source]

Return a short human-readable label for a time bin.

The label format adapts to the bin width: * ≤ 2 days → YYYY-MM-DD HH:MM * ≤ 60 days → YYYY-MM-DD * ≤ 400 days → YYYY-Www (ISO week) * otherwise → YYYY-MM

seiscat.plot.plot_timeline_utils.get_bin_size_label(bins, bins_spec=None)[source]

Return a concise label describing the effective bin size.

Parameters:
  • bins – list of (bin_start, bin_end, count) tuples

  • bins_spec – user-provided bin spec from CLI

Returns:

string such as 'auto, 7 days' or '20 bins, 7 days each'

seiscat.plot.plot_timeline_utils.get_cumulative_event_times_and_counts(events)[source]

Return cumulative event count over chronologically sorted raw event times.

Parameters:

events – EventList of Event dicts

Returns:

tuple (times, counts) where times is a sorted list of timezone-aware datetimes and counts is [1, 2, ..., N]

seiscat.plot.plot_timeline_utils.get_event_times_and_values(events, attribute)[source]

Extract event times and the value of a given attribute.

Events for which the attribute is missing or non-numeric are silently skipped.

Parameters:
  • events – EventList of Event dicts

  • attribute – name of the event attribute to extract

Returns:

list of (datetime, float) tuples, sorted by time

seiscat.plot.plot_timeline_utils.get_event_times_values_and_events(events, attribute, colorby=None)[source]

Extract event times, numeric attribute values, and source events.

Events for which the plotted attribute is undefined/non-numeric are skipped. If colorby is provided and differs from attribute, events with undefined/non-numeric color values are also skipped.

Parameters:
  • events – EventList of Event dicts

  • attribute – name of the event attribute to extract

  • colorby – optional name of the color attribute

Returns:

list of (datetime, float, event) tuples, sorted by time

plot_timeline_matplotlib

Plot catalog timeline using matplotlib.

copyright:

2022-2026 Claudio Satriano <satriano@ipgp.fr>

license:

GNU General Public License v3.0 or later (https://www.gnu.org/licenses/gpl-3.0-standalone.html)

seiscat.plot.plot_timeline_matplotlib.plot_catalog_timeline_matplotlib(events, config)[source]

Plot the catalog timeline using matplotlib.

Parameters:
  • events – EventList of Event dicts

  • config – config object

plot_timeline_plotly

Plot catalog timeline using Plotly (interactive HTML).

copyright:

2022-2026 Claudio Satriano <satriano@ipgp.fr>

license:

GNU General Public License v3.0 or later (https://www.gnu.org/licenses/gpl-3.0-standalone.html)

seiscat.plot.plot_timeline_plotly.plot_catalog_timeline_plotly(events, config)[source]

Plot the catalog timeline as an interactive HTML page using Plotly.

Parameters:
  • events – EventList of Event dicts

  • config – config object

plot_timeline_terminal

Plot catalog event count over time in the terminal.

copyright:

2022-2026 Claudio Satriano <satriano@ipgp.fr>

license:

GNU General Public License v3.0 or later (https://www.gnu.org/licenses/gpl-3.0-standalone.html)

seiscat.plot.plot_timeline_terminal.plot_catalog_timeline_terminal(events, config)[source]

Print a horizontal bar chart of event count per time bin to the terminal.

Modes: - Count only: shows per-bin event counts as bars - Cumulative only: shows raw cumulative event counts over time - Both: shows per-bin counts as bars plus cumulative totals

Only count mode is supported for the terminal backend. If the user selects --attribute mode the command will still show counts and print an informational note.

Parameters:
  • events – EventList of Event dicts

  • config – config object

print

Print functions for seiscat.

copyright:

2022-2026 Claudio Satriano <satriano@ipgp.fr>

license:

GNU General Public License v3.0 or later (https://www.gnu.org/licenses/gpl-3.0-standalone.html)

Print the catalog.

copyright:

2022-2026 Claudio Satriano <satriano@ipgp.fr>

license:

GNU General Public License v3.0 or later (https://www.gnu.org/licenses/gpl-3.0-standalone.html)

seiscat.print.print_catalog.print_catalog(config)[source]

Print catalog.

Parameters:

config – config object

Interactive table pager using curses.

copyright:

2022-2026 Claudio Satriano <satriano@ipgp.fr>

license:

GNU General Public License v3.0 or later (https://www.gnu.org/licenses/gpl-3.0-standalone.html)

exception seiscat.print.pager.PagerException[source]

Bases: Exception

Exception raised when the pager fails.

seiscat.print.pager.display_table_pager(header, body_rows, raw_data=None, default_sort_col=None, default_sort_asc=True, max_col_width=40)[source]

Display table with fixed header and alternating row font colors using curses scrolling. Supports interactive sorting by column.

Parameters:
  • header – header row string

  • body_rows – list of body row strings

  • raw_data – optional dict with ‘fields’ (list of column names) and ‘rows’ (list of row data lists) for interactive sorting

  • default_sort_col – default column index for sorting (can be restored with 0 key)

  • default_sort_asc – default sort direction (True for ascending)

  • max_col_width – maximum width for table columns in characters (longer values are truncated with …)

Raises:

PagerException – if the pager fails to initialize or run

utils

Utility functions for seiscat.

copyright:

2022-2026 Claudio Satriano <satriano@ipgp.fr>

license:

GNU General Public License v3.0 or later (https://www.gnu.org/licenses/gpl-3.0-standalone.html)

Function to convert data types.

copyright:

2021-2026 Claudio Satriano <satriano@ipgp.fr>

license:

GNU General Public License v3.0 or later (https://www.gnu.org/licenses/gpl-3.0-standalone.html)

seiscat.utils.conversion.float_or_none(string)[source]

Convert string to float, return None if conversion fails or if the value is NaN.

Parameters:

string (str) – Input string.

Returns:

Float value or None.

Return type:

float or None

seiscat.utils.conversion.int_or_none(string)[source]

Convert string to int, return None if conversion fails.

Parameters:

string (str) – Input string.

Returns:

Integer value or None.

Return type:

int or None

Exit functions.

copyright:

2022-2026 Claudio Satriano <satriano@ipgp.fr>

license:

GNU General Public License v3.0 or later (https://www.gnu.org/licenses/gpl-3.0-standalone.html)

class seiscat.utils.exit.ExceptionExit(additional_msg=None)[source]

Bases: AbstractContextManager

Context manager to exit when an exception is raised.

seiscat.utils.exit.err_exit(msg)[source]

Print an error message and exit.

Parameters:

msg – error message

seiscat.utils.exit.set_debug(debug)[source]

Enable or disable debug mode for error handling.

copyright:

2022-2026 Claudio Satriano <satriano@ipgp.fr>

license:

GNU General Public License v3.0 or later (https://www.gnu.org/licenses/gpl-3.0-standalone.html)

Write a sample script file for the “run” command.

copyright:

2022-2026 Claudio Satriano <satriano@ipgp.fr>

license:

GNU General Public License v3.0 or later (https://www.gnu.org/licenses/gpl-3.0-standalone.html)

seiscat.utils.sample_script.write_sample_script()[source]

Write a sample script file for the “run” command.

Check if it is ok to write to a file.

copyright:

2022-2026 Claudio Satriano <satriano@ipgp.fr>

license:

GNU General Public License v3.0 or later (https://www.gnu.org/licenses/gpl-3.0-standalone.html)

seiscat.utils.write_ok.write_ok(filepath)[source]

Check if it is ok to write to a file.

Parameters:

filepath – path to the file

Returns:

True if it is ok to write to the file, False otherwise