src.data_manager module¶
-
exception
src.data_manager.DataQueryFailure(dataset, msg='')[source]¶ Bases:
ExceptionException signaling a failure to find requested data in the remote location.
Raised by
queryData()to signal failure of a data query. Should be caught properly inplanData()orfetchData().
-
exception
src.data_manager.DataAccessError(dataset, msg='')[source]¶ Bases:
ExceptionException signaling a failure to obtain data from the remote location.
-
class
src.data_manager.DataSet(*args, **kwargs)[source]¶ Bases:
src.util.NameSpaceClass to describe datasets.
https://stackoverflow.com/a/48806603 for implementation.
-
class
src.data_manager.DataManager(case_dict, DateFreqMixin=None)[source]¶ Bases:
object-
__init__(case_dict, DateFreqMixin=None)[source]¶ Initialize self. See help(type(self)) for accurate signature.
-
iter_pods()[source]¶ Generator iterating over all pods which haven’t been skipped due to requirement errors.
-
iter_vars()[source]¶ Generator iterating over all variables in all pods which haven’t been skipped due to requirement errors.
-
static
dataset_key(dataset)[source]¶ Return immutable representation of DataSet. Two DataSets should have the same key
-
local_path(data_key)[source]¶ Returns the absolute path of the local copy of the file for dataset.
This determines the local model data directory structure, which is $MODEL_DATA_ROOT/<CASENAME>/<freq>/<CASENAME>.<var name>.<freq>.nc’. Files not following this convention won’t be found.
-
_iter_populated_varlist(var_iter, pod_name)[source]¶ Generator function yielding either a variable, its alternates if the variable was not found in the data query, or DataQueryFailure if the variable request can’t be satisfied with found data.
-
remote_data_list()[source]¶ Process list of requested data to make data fetching efficient.
This is intended as a hook to be used by subclasses. Default behavior is to delete from the list duplicate datasets and datasets where a local copy of the data already exists and is current (as determined by
local_data_is_current()).- Returns: collection of
DataSet objects.
- Returns: collection of
-
_fetch_order_function= None¶
-
local_data_is_current(dataset)[source]¶ Determine if local copy of data needs to be refreshed.
This is intended as a hook to be used by subclasses. Default is to always return False, ie always fetch remote data.
- Returns: True if local copy of data exists and remote copy hasn’t been
updated.
-
_backup_config_file(config)[source]¶ Record settings in file variab_dir/config_save.json for rerunning
-
_abc_impl= <_abc_data object>¶
-
-
class
src.data_manager.LocalfileDataManager(case_dict, DateFreqMixin=None)[source]¶ Bases:
src.data_manager.DataManager-
_abc_impl= <_abc_data object>¶
-
class
DataKey(name_in_model, date_freq)¶ Bases:
tuple-
_asdict()¶ Return a new OrderedDict which maps field names to their values.
-
_field_defaults= {}¶
-
_fields= ('name_in_model', 'date_freq')¶
-
_fields_defaults= {}¶
-
classmethod
_make(iterable)¶ Make a new DataKey object from a sequence or iterable
-
_replace(**kwds)¶ Return a new DataKey object replacing specified fields with new values
-
property
date_freq¶ Alias for field number 1
-
property
name_in_model¶ Alias for field number 0
-
-
dataset_key(dataset)[source]¶ Return immutable representation of DataSet. Two DataSets should have the same key
-