obspy.clients.filesystem.tsindex.Indexer

class Indexer(root_path, database='timeseries.sqlite', index_cmd='mseedindex', bulk_params=None, filename_pattern='*', parallel=5, leap_seconds_file=None, loglevel=None)[source]

Bases: object

Build an index for miniSEED data using EarthScope’s mseedindex program. Recursively search for files matching filename_pattern starting from root_path and run index_cmd for each target file found that is not already in the index. After all new files are indexed a summary table is generated with the extents of each timeseries.

Public Methods

build_file_list

Create a list of absolute paths to all files under root_path that match the filename_pattern.

run

Execute the file discovery and indexing.

Private Methods

Warning

Private methods are mainly for internal/developer use and their API might change without notice.

Indexer._get_rootpath_files(relative_paths=False)[source]

Return a list of absolute paths to files under the rootpath that match the Indexers filename pattern

Indexer._is_index_cmd_installed()[source]

Checks if the index command (e.g. mseedindex) is installed.

Return type:

bool

Returns:

Returns True if the index_cmd is installed.

classmethod Indexer._run_index_command(index_cmd, root_path, file_name, bulk_params)[source]

Execute a command to perform indexing.

Parameters:
  • index_cmd (str) – Name of indexing command to execute. Defaults to mseedindex.

  • file_name (str) – Name of file to index.

  • bulk_params (dict) – Dictionary of options to pass to index_cmd.

Special Methods

Indexer.__delattr__(name, /)

Implement delattr(self, name).

Indexer.__dir__()

Default dir() implementation.

Indexer.__eq__(value, /)

Return self==value.

Indexer.__format__(format_spec, /)

Default object formatter.

Indexer.__ge__(value, /)

Return self>=value.

Indexer.__getattribute__(name, /)

Return getattr(self, name).

Indexer.__gt__(value, /)

Return self>value.

Indexer.__hash__()

Return hash(self).

Indexer.__init__(root_path, database='timeseries.sqlite', index_cmd='mseedindex', bulk_params=None, filename_pattern='*', parallel=5, leap_seconds_file=None, loglevel=None)[source]

Initializes the Indexer.

Parameters:
  • root_path (str) – Root path to the directory structure to index.

  • database (str or TSIndexDatabaseHandler) – Path to SQLite tsindex database or a TSIndexDatabaseHandler object. A database will be created if one does not already exists at the specified path.

  • index_cmd (str) – Command to be run for each target file found that is not already in the index

  • bulk_params (dict) – Dictionary of options to pass to index_cmd.

  • filename_pattern (str) – Glob pattern to determine what files to index.

  • parallel (int) – Max number of index_cmd instances to run in parallel. By default a max of 5 parallel process are run.

  • loglevel – DEPRECATED and without effect

  • leap_seconds_file – DEPRECATED and without effect

Indexer.__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

Indexer.__le__(value, /)

Return self<=value.

Indexer.__lt__(value, /)

Return self<value.

Indexer.__ne__(value, /)

Return self!=value.

Indexer.__new__(**kwargs)
Indexer.__reduce__()

Helper for pickle.

Indexer.__reduce_ex__(protocol, /)

Helper for pickle.

Indexer.__repr__()

Return repr(self).

Indexer.__setattr__(name, value, /)

Implement setattr(self, name, value).

Indexer.__sizeof__()

Size of object in memory, in bytes.

Indexer.__str__()

Return str(self).

Indexer.__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).