SeisCat API

Start here to navigate the SeisCat source code.

seiscat

Main script for seiscat.

copyright:

2022-2023 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.scripts.seiscat.main()[source]

Main function. Catch KeyboardInterrupt.

seiscat.scripts.seiscat.run()[source]

db

Database functions for seiscat.

copyright:

2022-2023 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.db.check_db_exists(config, initdb)[source]

Check if database file exists.

Parameters:
  • config – config object

  • initdb – if True, create new database file

seiscat.db.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

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

seiscat.db.get_catalog_stats(config)[source]

Get a string with catalog statistics.

Parameters:

config – config object

Returns:

string with catalog statistics

seiscat.db.read_events_from_db(config)[source]

Read events from database. Return a list of events.

Parameters:

config – config object

Returns:

list of events, each event is a dictionary

seiscat.db.read_fields_and_rows_from_db(config, eventid=None, version=None)[source]

Read fields and rows from database. Return a list of fields and a list of rows.

Parameters:
  • config – config object

  • eventid – limit to events with this evid

  • version – limit to events with this version (ignored if eventid is None)

Returns:

list of fields, list of rows

seiscat.db.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

seiscat.db.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

seiscat.db.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

download_and_store

Download and store events.

copyright:

2022-2023 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.download_and_store.download_and_store(config, initdb)[source]

Download events and store them in the database.

Parameters:
  • config – config object

  • initdb – if True, create new database file

editdb

Edit functions for seiscat.

copyright:

2022-2023 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.editdb.editdb(config)[source]

Edit database.

Parameters:

config – config object

fdsnws

FDSN webservices functions for seiscat.

copyright:

2022-2023 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.fdsnws.InvalidQuery[source]

Bases: Exception

Invalid query exception.

class seiscat.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.fdsnws.open_fdsn_connection(config)[source]

Open FDSN connection. Return a FDSN client object.

Parameters:

config – config object

Returns:

FDSN client object

seiscat.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

parse_arguments

Argument parsing for seiscat.

copyright:

2022-2023 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.parse_arguments.parse_arguments()[source]

Parse command line arguments.

plot

Plotting functions for seiscat.

copyright:

2022-2023 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_catalog_map(config)[source]

Plot the catalog map.

Parameters:

config – config object

print

Printing functions for seiscat.

copyright:

2022-2023 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(config)[source]

Print catalog.

Parameters:

config – config object

seiscat.print.print_catalog_stats(config)[source]

Print catalog statistics.

Parameters:

config – config object

seiscat.print.print_catalog_table(config, eventid=None, version=None)[source]

Pretty-print the catalog as a table.

Parameters:

config – config object

utils

Utility functions for seiscat.

copyright:

2022-2023 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.err_exit(msg)[source]

Print an error message and exit.

Parameters:

msg – error message

seiscat.utils.parse_configspec()[source]

Parse the configspec file.

Returns:

configspec object

seiscat.utils.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.utils.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

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

Write a sample config file.

Parameters:
  • configspec – configspec object

  • progname – program name