zen_garden.preprocess.extract_input_data¶
Functions to extract the input data from the provided input files.
Classes
|
Class to extract input data. |
- class zen_garden.preprocess.extract_input_data.DataInput(element, system, analysis, solver, energy_system, unit_handling, optimization_setup=None)¶
Class to extract input data.
- __init__(element, system, analysis, solver, energy_system, unit_handling, optimization_setup=None)¶
Data input object to extract input data.
- Parameters:
element – element for which data is extracted
system – dictionary defining the system
analysis – dictionary defining the analysis framework
solver – dictionary defining the solver
energy_system – instance of class <EnergySystem> to define energy_system
unit_handling – instance of class <UnitHandling> to convert units
- construct_index_list(index_sets, time_steps)¶
Constructs index list from index sets and returns list of indices and list of index names.
- Parameters:
index_sets – index sets of attribute. Creates (multi)index. Corresponds to order in pe.Set/pe.Param
time_steps – specific time_steps of element
- Returns:
list of indices index_name_list: list of name of indices
- Return type:
index_list
- convert_real_to_generic_time_indices(df_input, time_steps, file_name, index_name_list)¶
Convert yearly time indices to generic time indices.
- Parameters:
df_input – raw input dataframe
time_steps – specific time_steps of element
file_name – name of selected file
index_name_list – list of name of indices
- Returns:
df_input: input dataframe with generic time indices
- create_default_output(index_sets, unit_category, file_name=None, time_steps=None, manual_default_value=None, subelement=None)¶
Creates default output dataframe.
- Parameters:
index_sets – index sets of attribute. Creates (multi)index. Corresponds to order in pe.Set/pe.Param
unit_category – dict defining the dimensions of the parameter’s unit
file_name – name of selected file.
time_steps – specific time_steps of subelement
manual_default_value – if given, use manual_default_value instead of searching for default value in attributes.json
subelement – dependent element for which data is extracted
- extract_attribute(attribute_name, unit_category, return_unit=False, subelement=None)¶
Reads input data and restructures the dataframe to return (multi)indexed dict.
- Parameters:
attribute_name – name of selected attribute
unit_category – dict defining the dimensions of the parameter’s unit
return_unit – only returns unit
subelement – dependent element for which data is extracted
- Returns:
attribute value and multiplier
- Returns:
unit of attribute
- extract_carriers(carrier_type)¶
Reads input data and extracts conversion carriers.
- Returns:
list with input, output or reference carriers of technology
- Return type:
list
- static extract_from_input_for_capacities_existing(df_input, df_output, index_name_list, column, missing_index)¶
Extracts the demanded values from input dataframe if extracting existing capacities.
- Parameters:
df_input – raw input dataframe
df_output – default output dataframe
index_name_list – list of name of indices
column – select specific column
missing_index – missing index in df_input
- Returns:
df_output: filled output dataframe
- static extract_from_input_with_missing_index(df_input, df_output, index_name_list, file_name, missing_index)¶
Extracts the demanded values from Input dataframe and reformulates dataframe if the index is missing. Either, the missing index is the column of df_input, or it is actually missing in df_input. Then, the values in df_input are extended to all missing index values.
- Parameters:
df_input – raw input dataframe
df_output – default output dataframe
index_name_list – list of name of indices
file_name – name of selected file
missing_index – missing index in df_input
- Returns:
reformulated input dataframe
- Return type:
pandas.DataFrame
- static extract_from_input_without_missing_index(df_input, index_name_list, file_name)¶
Extracts the demanded values from Input dataframe and reformulates dataframe.
- Parameters:
df_input – raw input dataframe
index_name_list – list of name of indices
file_name – name of selected file
- Returns:
df_input: reformulated input dataframe
- extract_general_input_data(df_input, df_output, file_name, index_name_list, default_value, time_steps)¶
Fills df_output with data from df_input.
- Parameters:
df_input – raw input dataframe
df_output – empty output dataframe, only filled with default_value
file_name – name of selected file
index_name_list – list of name of indices
default_value – default for dataframe
time_steps – specific time_steps of element
- Returns:
df_output: filled output dataframe
- extract_input_data(file_name, index_sets, unit_category, time_steps=None, subelement=None)¶
Reads input data and restructures the dataframe to return (multi)indexed dict.
- Parameters:
file_name – name of selected file.
index_sets – index sets of attribute. Creates (multi)index. Corresponds to order in pe.Set/pe.Param
unit_category – dict defining the dimensions of the parameter’s unit
time_steps – string specifying time_steps
subelement – string specifying dependent element
- Returns:
dictionary with attribute values
- extract_lifetime_existing(file_name, index_sets)¶
Reads input data and restructures the dataframe to return (multi)indexed dict.
- Parameters:
file_name – name of selected file
index_sets – index sets of attribute. Creates (multi)index. Corresponds to order in pe.Set/pe.Param
- Returns:
return existing capacity and existing lifetime
- Return type:
df_output
- extract_locations(extract_nodes=True, extract_coordinates=False)¶
Reads input data to extract nodes or edges.
- Args
extract_nodes: boolean to switch between nodes and edges
extract_coordinates: boolean to switch between nodes and nodes + coordinates
- extract_pwa_capex()¶
Reads input data and restructures the dataframe to return (multi)indexed dict.
- Returns:
pwa_dict: dictionary with pwa parameters
- extract_retrofit_base_technology()¶
Extract base technologies for retrofitting technology.
- Returns:
return base technology of retrofit technology
- extract_set_technologies_existing(storage_energy=False)¶
Reads input data and creates setExistingCapacity for each technology.
- Parameters:
storage_energy – boolean if existing energy capacity of storage technology (instead of power)
- Returns:
return set existing technologies
- Return type:
set_technologies_existing
- extract_year_specific_ts(file_name, index_name_list, time_steps, subelement, default_value, df_output_generic)¶
Reads and saves the year specific time series data. The year specific time series are saved in the dictionary self.optimization_setup.year_specific_ts.
- Parameters:
file_name – name of selected file
index_name_list – list of name of indices
default_value – default for dataframe
time_steps – specific time_steps of element
subelement – string specifying dependent element
df_output_generic – original/generic time series data (base case)
- extract_yearly_variation(file_name, index_sets)¶
Reads the yearly variation of a time dependent quantity.
- Parameters:
file_name – name of selected file.
index_sets – index sets of attribute. Creates (multi)index. Corresponds to order in pe.Set/pe.Param
- get_attribute_dict(attribute_name)¶
Get attribute dict and factor for attribute.
- Parameters:
attribute_name – name of selected attribute
- Returns:
attribute_dict: attribute dict
- Returns:
factor: factor for attribute
- load_attribute_file(filename='attributes')¶
Loads attribute file. Either as csv (old version) or json (new version) :param filename: name of attributes file, default is ‘attributes’ :return: attribute_dict.
- read_input_csv(input_file_name)¶
Reads input data and returns raw input dataframe.
- Parameters:
input_file_name – name of selected file
- Returns:
df_input: pd.DataFrame with input data
- read_input_json(input_file_name)¶
Reads json input data and returns a dict.
- Parameters:
input_file_name – name of selected file
- Returns:
data: dict with input data
- read_pwa_capex_files()¶
Reads pwa files.
- Returns:
df_input: raw input file