table_data_reader

class table_data_reader.Parameter(name, tags=None, source_scenarios_string: str = None, unit: str = None, comment: str = None, source: str = None, version=None, **kwargs)[source]

A single parameter

processes = None

optional comma-separated list of tags

class table_data_reader.ParameterRepository[source]

Contains all known parameter definitions (so that it is not necessary to re-read the excel file for repeat param accesses). The param definitions are independent from the sampling (the Param.__call__ method). Repeat access to __call__ will create new samples.

Internally, parameters are organised together with all the scenario variants in a single ParameterScenarioSet.

add_parameter(parameter: table_data_reader.Parameter)[source]

A parameter can have several scenarios. They are specified as a comma-separated list in a string. :param parameter: :return:

fill_missing_attributes_from_default_parameter(param)[source]

Empty fields in Parameter definitions in scenarios are populated with default values.

E.g. in the example below, the source for the Power_TV variable in the 8K scenario would also be EnergyStar.

name scenario val tags source
Power_TV Power_TV 8K 60 85 UD, TV new_tag EnergyStar

Note tags must not differ. In the example above, the 8K scenario variable the tags value would be overwritten with the default value.

Parameters:param
Returns:
find_by_tag(tag) → Dict[str, Set[table_data_reader.Parameter]][source]

Get all registered dicts that are registered for a tag

Parameters:tag – str - single tag
Returns:a dict of {param name: set[Parameter]} that contains all ParameterScenarioSets for all parameter names with a given tag
class table_data_reader.ParameterScenarioSet[source]

The set of all version of a parameter for all the scenarios.

add_scenario(parameter: table_data_reader.Parameter, scenario_name: str = 'default')[source]

Add a scenario for this parameter.

Parameters:
  • scenario_name
  • parameter
Returns:

default_scenario = 'default'

the name of the parameters in this set

table_data_reader.growth_coefficients(start_date, end_date, ref_date, alpha, samples)[source]

Build a matrix of growth factors according to the CAGR formula y’=y0 (1+a)^(t’-t0).

a growth rate alpha t0 start date t’ end date y’ output y0 start value