squirrel.io
¶
-
iload
(paths, segment=None, format='detect', database=None, check=True, commit=True, skip_unchanged=False, content=['waveform', 'station', 'channel', 'response', 'event'])[source]¶ Iteratively load content or index/reindex meta-information from files.
Parameters: - paths – iterator yielding file names to load from or
Selection
object - segment (str) – file-specific segment identifier (con only be used when loading from a single file.
- format (str) – file format identifier or
'detect'
for autodetection. When loading from a selection, per-file format assignation is taken from the hint in the selection and this flag is ignored. - database (
Database
) – database to use for meta-information caching - check (bool) – if
True
, investigate modification time and file sizes of known files to debunk modified files (pessimistic mode), orFalse
to deactivate checks (optimistic mode) - commit (bool) – flag, whether to commit updated information to the meta-information database
- skip_unchanged (bool) – if
True
, only yield index nuts for new / modified files - content – list of strings, selection of content types to load
This generator yields
Nut
objects for individual pieces of information found when reading the given files. Such a nut may represent a waveform, a station, a channel, an event or other data type. The nut itself only contains the meta-information. The actual content information is attached to the nut if requested. All nut meta-information is stored in the squirrel meta-information database. If possible, this function avoids accessing the actual disk files and provides the requested information straight from the database. Modified files are recognized and reindexed as needed.- paths – iterator yielding file names to load from or
-
detect_format
(path)[source]¶ Determine file type from first 512 bytes.
Parameters: path (str) – path of file
-
get_backend
(fmt)[source]¶ Get squirrel io backend module for a given file format.
Params str fmt: format identifier
-
exception
FormatDetectionFailed
(path)[source]¶ Bases:
pyrocko.io.io_common.FileLoadError
Exception raised when file format detection fails.