User’s guide¶
Data manager¶
- class geospacelab.datahub.DataHub(dt_fr=None, dt_to=None, visual='off', **kwargs)¶
The core of the data manager in GeospaceLab to dock different datasets.
- Parameters
dt_fr (datetime.datetime) – starting time.
dt_to (datetime.datetime) – stopping time.
visual (str) – decide if a Visual object will be added to the variable objects. Options:[‘off’], ‘on’.
datasets (dict) – A dictionary that stores the datasets docked or added to the datahub. The keys (indices) are the integer numbers starting from 1.
variables (dict) – A dictionary that stores the variables assigned from their own datasets to the datahub. Typically used for the viewers or outputs.
- Example
- dock(datasource_contents, **kwargs)¶
To dock a sourced dataset.
- Parameters
datasource_contents (list) – the contents that required for docking a sourced dataset. To look up the sourced dataset and the associated contents, call
list_sourced_datasets()
.dt_fr (datetime.datetime) – starting time, optional, use datahub.dt_fr if not specified.
dt_to (datetime.datetime) – stopping time, optional, use datahub.dt_to if not specified.
visual (str) – variable attribute, use datahub.visual if not specified.
- Returns
a dataset
- Return type
object of
DatasetModel
- add_dataset(*args, kind='temporary', **kwargs)¶
Add one or multiple datasets, which is not sourced in the package.
- Parameters
args – a list of the datasets.
kind – the kind of a dataset, options: [‘temporary’], or ‘user-defined’. if temporary, a new dataset will be created from the DatasetModel.
kwargs – other keywords
- Returns
None
- get_variable(var_name, dataset=None, dataset_index=None)¶
To get a variable from the docked or added dataset.
- Parameters
var_name – the name of the queried variable
dataset – the dataset storing the queried variable.
dataset_index – the index of the dataset in datahub.datasets. if both dataset or dataset_index are not specified, the function will get the variable from the assigned variables.
- Returns
object of
VariableModel
or None if not existing.
- assign_variable(var_name, dataset=None, dataset_index=None, add_new=False, **kwargs)¶
Assign a variable from the docked or added dataset.
- Parameters
var_name – The name of the variable
dataset – The dataset that stores the variable
dataset_index – The index of the dataset in the datahub.datasets.
add_new – if True, add the variable to the specified dataset and assign to the datahub
kwargs – other keywords to configure the attributes of the variable.
- Returns
object of
VariableModel
- static list_sourced_datasets()¶
To list all the sourced datasets bult-in this package
The list will be printed in the python console in a “tree” view.
- list_datasets()¶
To list all the datasets that have been docked or added to the datahub
The list will be printed in the console as a table
- list_assigned_variables()¶
To list all the assigned variables that have been docked or added to the datahub
The list will be printed in the console as a table