marmot.formatters.formatbase.Process#

class Process(input_folder: pathlib.Path, output_file_path: pathlib.Path, *_, region_mapping: pandas.core.frame.DataFrame = Empty DataFrame Columns: [] Index: [], emit_names_dict: typing.Optional[dict] = None, **__)[source]#

Bases: object

Base class for processing simulation model data.

Parameters
  • input_folder (Path) – Folder containing model input files.

  • output_file_path (Path) – Path to formatted h5 output file.

  • region_mapping (pd.DataFrame, optional) – DataFrame to map custom regions/zones to create custom aggregations. Defaults to pd.DataFrame().

  • emit_names_dict (dict, optional) – Dictionary to rename emission names. Defaults to None.

Methods

combine_models(model_list[, drop_duplicates])

Combine temporally disaggregated model results.

get_processed_data(prop_class, property, ...)

method template for get_processed_data

output_metadata(files_list)

method template for output_metadata

Attributes

EXTRA_PROPERTIES_CLASS

PROPERTY_MAPPING

Maps simulation model property names to Marmot property names

UNITS_CONVERSION

Dictionary to convert units to standard values used by Marmot

data_collection

Dictionary model names to full filename path

get_input_data_paths

Gets a list of input files within the scenario folders

input_folder

Path to input folder

PROPERTY_MAPPING: dict = {}#

Maps simulation model property names to Marmot property names

UNITS_CONVERSION: dict = {'kW': ('MW', 0.001), 'MW': ('MW', 1), 'GW': ('MW', 1000.0), 'TW': ('MW', 1000000.0), 'kWh': ('MWh', 0.001), 'MWh': ('MWh', 1), 'GWh': ('MWh', 1000.0), 'TWh': ('MWh', 1000000.0), 'lb': ('kg', 0.453592), 'ton': ('kg', 907.18474), 'kg': ('kg', 1), 'tonne': ('kg', 1000), 'metric tons': ('kg', 1000), '$': ('$', 1), '2004$': ('$', 1), '$000': ('$', 1000), 'h': ('h', 1), 'MMBTU': ('MMBTU', 1), 'GBTU': ('MMBTU', 1000), 'GJ"': ('MMBTU', 0.947817), 'TJ': ('MMBTU', 947.81712), '$/MW': ('$/MW', 1), '$/MWh': ('$/MWh', 1), 'lb/MWh': ('kg/MWh', 0.453592), 'Kg/MWh': ('Kg/MWh', 1), 'Quads': ('Quads', 1), 'MW/yr': ('MW/yr', 1), 'frac': ('fraction', 1), 'fraction': ('fraction', 1), None: ('unitless', 1), 'unitless': ('unitless', 1)}#

Dictionary to convert units to standard values used by Marmot

property input_folder: pathlib.Path#

Path to input folder

Returns

input_folder

Return type

Path

property get_input_data_paths: list#

Gets a list of input files within the scenario folders

Returns

list of input filenames to process

Return type

list

property data_collection: Dict[str, pathlib.Path]#

Dictionary model names to full filename path

Returns

data_collection {filename: fullpath}

Return type

dict

output_metadata(files_list: list) None[source]#

method template for output_metadata

Parameters

files_list (list) – list of string files or filenames

get_processed_data(prop_class: str, property: str, timescale: str, model_name: str) pandas.core.frame.DataFrame[source]#

method template for get_processed_data

Parameters
  • prop_class (str) – class e.g Region, Generator, Zone etc

  • property (str) – Property e.g gen_out, cap_out etc.

  • timescale (str) – Data timescale, e.g interval, summary.

  • model_name (str) – name of model to process.

Returns

pd.DataFrame

Return type

pd.DataFrame

combine_models(model_list: list, drop_duplicates: bool = True) pandas.core.frame.DataFrame[source]#

Combine temporally disaggregated model results.

Will drop duplicate index entries by default.

Parameters
  • model_list (list) – list of df models to combine.

  • drop_duplicates (bool, optional) – Drop duplicate index entries. Defaults to True.

Returns

Combined df

Return type

pd.DataFrame