tokio.cli.archive_lmtdb module

Retrieve the contents of an LMT database and cache it locally.

class tokio.cli.archive_lmtdb.DatasetDict(query_start, query_end, timestep, sort_hex=True, *args, **kwargs)[source]

Bases: dict

A dictionary containing TimeSeries objects

Contains the TimeSeries objects being populated from an LMT database. Implemented as a class so that a single object can store all of the TimeSeries objects that are generated by multiple method calls.

archive_mds_data(lmtdb)[source]

Extract and encode data from LMT’s MDS_DATA table

Queries the LMT database, interprets resulting rows, and populates a dictionary of TimeSeries objects with those values.

Parameters:lmtdb (LmtDb) – database object
archive_mds_ops_data(lmtdb)[source]

Extract and encode data from LMT’s MDS_OPS_DATA table

Queries the LMT database, interprets resulting rows, and populates a dictionary of TimeSeries objects with those values. Avoids JOINing the MDS_VARIABLE_INFO table and instead uses an internal mapping of OPERATION_IDs to demultiplex the data in MDS_OPS_DATA into different HDF5 datasets.

Parameters:lmtdb (LmtDb) – database object
archive_oss_data(lmtdb)[source]

Extract and encode data from LMT’s OSS_DATA table

Queries the LMT database, interprets resulting rows, and populates a dictionary of TimeSeries objects with those values.

Parameters:lmtdb (LmtDb) – database object
archive_ost_data(lmtdb)[source]

Extract and encode data from LMT’s OST_DATA table

Queries the LMT database, interprets resulting rows, and populates a dictionary of TimeSeries objects with those values.

Parameters:lmtdb (LmtDb) – database object
convert_deltas(dataset_names)[source]

Convert datasets from absolute values to values per timestep

Given a list of dataset names, determine if they need to be converted from monotonically increasing counters to counts per timestep, and convert those that do. For those that don’t, trim off the final row since it is not needed to calculate the difference between rows.

Parameters:dataset_names (list of str) – keys corresponding to self.config for the datasets to be converted/corrected
finalize()[source]

Convert datasets to deltas where necessary and tack on metadata

Perform a few finishing actions to all datasets contained in self after they have been populated. Such actions are configured entirely in self.config and require no external input.

init_datasets(dataset_names, columns)[source]

Populate empty datasets within self

Creates and attachs TimeSeries objects to self based on a given column list

Parameters:
  • dataset_names (list of str) – keys corresponding to self.config defining which datasets are being initialized
  • columns (list of str) – column names to use in the TimeSeries datasets being created
set_timeseries_metadata(dataset_names)[source]

Set metadata constants (version, units, etc) on datasets and groups

Parameters:dataset_names (list of str) – keys corresponding to self.config for the datasets whose metadata should be set
tokio.cli.archive_lmtdb.archive_lmtdb(lmtdb, init_start, init_end, timestep, output_file, query_start, query_end)[source]

Given a start and end time, retrieve all of the relevant contents of an LMT database.

tokio.cli.archive_lmtdb.init_hdf5_file(datasets, init_start, init_end, hdf5_file)[source]

Initialize the datasets at full dimensions in the HDF5 file if necessary

tokio.cli.archive_lmtdb.main(argv=None)[source]

Entry point for the CLI interface