smif.parameters.narrative module

Contains classes and methods relating to narratives.

Narrative hold collections of overridden parameter data. During model setup, a user compiles a number of narrative files which contains a list of parameter names and values. These are assigned to a narrative set during a model run and the Narrative object holds this information at runtime.

Summary

Classes:

Narrative Holds information relating to parameters from a collection of narrative policies

Reference

class smif.parameters.narrative.Narrative(name, description, narrative_set)[source]

Bases: object

Holds information relating to parameters from a collection of narrative policies

Parameters:
  • name (str) –
  • description (str) –
  • narrative_set (str) –

Example

>>> narrative = Narrative('Energy Demand - High Tech',
                              'A description',
                              'technology')
data

The narrative data keyed by model name or global

Returns:A nested dictionary containing the narrative data:
{
    'global': [
        {'global_parameter': 'value'}
    ],
    'model_name': [
        {'model_parameter': 'value'},
        {'model_parameter_two': 'value'}
    ]
}
Return type:dict
as_dict()[source]

Serialise the narrative data

Returns:A dictionary of serialised narrative metadata:
{'name': 'a_name',
 'description': 'a description',
 'narrative_set': 'a_narrative_set'}
Return type:dict