otoole.preprocess package


otoole.preprocess.create_datapackage module

Creates a datapackage from a collection of CSV files of OSeMOSYS input data

  • Uses Frictionless Data datapackage concept to build a JSON schema of the dataset
  • Enforces relations between sets and indices in parameter files

Creates a datapackage in folder path_to_package

[{‘fields’: ‘REGION’, ‘reference’: {‘resource’: ‘REGION’, ‘fields’: ‘VALUE’}}]


otoole.preprocess.longify_data module

Read in a folder of irregular wide-format csv files and write them out as narrow csvs

otoole.preprocess.longify_data.check_datatypes(df: pandas.core.frame.DataFrame, config_details: Dict[KT, VT], parameter: str) → pandas.core.frame.DataFrame[source]

Checks a parameters datatypes

  • df (pandas.DataFrame) – The parameter data
  • config_details (dict) – The configuration dictionary
  • parameter (str) – The name of the parameter
otoole.preprocess.longify_data.check_set_datatype(narrow: pandas.core.frame.DataFrame, config_details: Dict[KT, VT], set_name: str) → pandas.core.frame.DataFrame[source]

Checks the datatypes of a set_name dataframe

  • narrow (pandas.DataFrame) – The set data
  • config_details (dict) – The configuration dictionary
  • set_name (str) – The name of the set

Module contents