sssparser package

Submodules

sssparser.DataConfig module

class sssparser.DataConfig.DataConfig(fp)[source]

Bases: list

Base class for all data configs

fetch()[source]
ids
find_by_id(config_id)[source]
class sssparser.DataConfig.ConfigSet(dataset_dir, scenario_data_dirname='ScenarioData')[source]

Bases: object

sssparser.ParseScenarios module

sssparser.ParseScenarios.parse_file_name(s, config_set)[source]

Parses the filename into the relevant configuration components and returns as a dict :param s: filename :return: dict

sssparser.ParseScenarios.group_file_info(l, d)[source]

Reduce function for grouping file dicts from parse_file_name by scenario :param l: :param d: :return: list

sssparser.ParseScenarios.parse_dataset(dataset_dir, scenario_data_dirname='ScenarioData')[source]

sssparser.ScenarioFile module

class sssparser.ScenarioFile.ScenarioFile(config_set, fp, scenario, attribute, temporal_resolution, spatial_resolution)[source]

Bases: object

Class representing individual input data files. Contains methods to parse and format those files based on configs.

SPATIAL_CUMULATIVE = {'id': 'total', 'label': 'Cumulative'}
TEMPORAL_CUMULATIVE = {'id': 'total', 'label': 'Cumulative'}
scenario_id
attribute_id
temporal_resolution_id
spatial_resolution_id
read()[source]
get_data()[source]

sssparser.ScenariosDataset module

class sssparser.ScenariosDataset.ScenariosDataset(dataset_dir, scenario_data_dirname='ScenarioData')[source]

Bases: object

Parameters:
  • dataset_dir (str) – Name of the directory containing the dataset to be examined, e.g. ‘NREL Standard Scenarios 2016’
  • scenario_data_dirname (str) – Directory that holds all of the datasets of interest (e.g. sssmatch/sssmixes)
GENMIX_ATTRIBUTES = ['capacity', 'generation']
gentypes

Assumes generator types can be inferred from ScenarioFiles with attribute_id == ‘capacity’ and spatial_resolution_id == ‘national’.

Returns:List of generator types found in the ScenariosDataset
Return type:list
years
scenarios
geographies
get_genmix(year, scenario_id, geography_ids)[source]

Return dataframe indexed by generator type and showing select attributes.

Parameters:
  • year (-) –
  • scenario_id (-) –
  • geogrpahy_id (-) –
get_timeseries(scenario_id, geography_ids)[source]

Calls self.get_genmix for every year in self.years. Returns a pandas.Series indexed by [‘dataset’,’scenario’,’geography’,’year’, ‘gentype’,’variable’]. The geography key is ‘,’.join(geography_ids).

sssparser.ScenariosDataset.multi_index(df, cols)[source]

Module contents

exception sssparser.SSSParserError[source]

Bases: Exception