smif.data_layer.abstract_data_store module¶
A data store holds the bulk of model setup, intermediate and output data: - scenario variant and narrative data (including parameter defaults) - model interventions, initial conditions and state - conversion coefficients - results
Summary¶
Classes:
DataStore |
A DataStore must implement each of the abstract methods defined in this interface |
Reference¶
-
class
smif.data_layer.abstract_data_store.
DataStore
[source]¶ Bases:
object
A DataStore must implement each of the abstract methods defined in this interface
-
read_scenario_variant_data
(key, spec, timestep=None)[source]¶ Read data array
Parameters: Returns: data_array
Return type:
-
read_narrative_variant_data
(key, spec, timestep=None)[source]¶ Read data array
Parameters: Returns: data_array
Return type:
-
read_model_parameter_default
(key, spec)[source]¶ Read data array
Parameters: Returns: data_array
Return type:
-
write_model_parameter_default
(key, data_array)[source]¶ Read data array
Parameters: Returns: data_array
Return type:
-
read_interventions
(key)[source]¶ Read interventions data for key
Parameters: key (str) – Returns: A dict of intervention dictionaries containing intervention attributes keyed by intervention name Return type: dict[str, dict]
-
read_initial_conditions
(key)[source]¶ Read historical interventions for key
Parameters: key (str) – Returns: Return type: list[dict]
-
write_initial_conditions
(key, initial_conditions)[source]¶ Write historical interventions for key
Parameters:
-
read_state
(modelrun_name, timestep, decision_iteration=None)[source]¶ Read list of (name, build_year) for a given model_run, timestep, decision
Parameters: Returns: Return type:
-
write_state
(state, modelrun_name, timestep, decision_iteration=None)[source]¶ State is a list of decisions with name and build_year.
State is output from the DecisionManager
Parameters:
-
read_coefficients
(source_dim, destination_dim)[source]¶ Reads coefficients from the store
Coefficients are uniquely identified by their source/destination dimensions. This method and write_coefficients implement caching of conversion coefficients between a single pair of dimensions.
Parameters: Returns: Return type: Notes
To be called from
Adaptor
implementations.
-
write_coefficients
(source_dim, destination_dim, data)[source]¶ Writes coefficients to the store
Coefficients are uniquely identified by their source/destination dimensions. This method and read_coefficients implement caching of conversion coefficients between a single pair of dimensions.
Parameters: - source_dim (str) – dimension name
- destination_dim (str) – dimension name
- data (numpy.ndarray) –
Notes
To be called from
Adaptor
implementations.
-
read_results
(modelrun_name, model_name, output_spec, timestep=None, decision_iteration=None)[source]¶ Return results of a model from a model_run for a given output at a timestep and decision iteration
Parameters: Returns: Return type:
-