-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 845ee00
Showing
141 changed files
with
11,486 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Sphinx build info version 1 | ||
# This file records the configuration used when building these files. When it is not found, a full rebuild will be done. | ||
config: d6d4dd102e5c6c3ee5e75e73f034af42 | ||
tags: 645f666f9bcd5a90fca523b33c5a78b7 |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+8.81 KB
.doctrees/autoapi/pybalmorel/interactive/interactive_functions/index.doctree
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+17.2 KB
.doctrees/autoapi/pybalmorel/plotting/production_profile/index.doctree
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Empty file.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# About this code | ||
|
||
This documentation is under construction |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
eel_dashboard | ||
============= | ||
|
||
.. py:module:: eel_dashboard | ||
Functions | ||
--------- | ||
|
||
.. autoapisummary:: | ||
|
||
eel_dashboard.get_wkdir | ||
eel_dashboard.create_incfile | ||
eel_dashboard.create_sets | ||
eel_dashboard.create_CCCRRRAAA | ||
eel_dashboard.create_setconnection | ||
eel_dashboard.create_incfiles | ||
eel_dashboard.interactive_geofilemaker | ||
|
||
|
||
Module Contents | ||
--------------- | ||
|
||
.. py:function:: get_wkdir() | ||
.. py:function:: create_incfile(unique_processing) | ||
The general wrapper for creating and saving .inc files, | ||
because the creating of the IncFile class and saving it is the same everytime. | ||
The unique processing of the .body content differs, however. | ||
|
||
Args: | ||
unique_processing (func): The unique processing per case | ||
**incfile_kwargs: Keyword arguments to pass to IncFile | ||
|
||
.. py:function:: create_sets(inc_file, geo_nodes_layer2: dict) | ||
.. py:function:: create_CCCRRRAAA(inc_file, geo_nodes: dict) | ||
.. py:function:: create_setconnection(inc_file, geo_nodes_layer1: dict) | ||
.. py:function:: create_incfiles(output: Tuple[str, dict], path: str, set_prefix: str = '') | ||
.. py:function:: interactive_geofilemaker() | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
API Reference | ||
============= | ||
|
||
This page contains auto-generated API reference documentation [#f1]_. | ||
|
||
.. toctree:: | ||
:titlesonly: | ||
|
||
/autoapi/pybalmorel/index | ||
/autoapi/eel_dashboard/index | ||
|
||
.. [#f1] Created with `sphinx-autoapi <https://github.com/readthedocs/sphinx-autoapi>`_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,265 @@ | ||
pybalmorel.classes | ||
================== | ||
|
||
.. py:module:: pybalmorel.classes | ||
.. autoapi-nested-parse:: | ||
|
||
Created on 08.06.2024 | ||
|
||
@author: Mathias Berg Rosendal, PhD Student at DTU Management (Energy Economics & Modelling) | ||
|
||
|
||
|
||
Classes | ||
------- | ||
|
||
.. autoapisummary:: | ||
|
||
pybalmorel.classes.MainResults | ||
pybalmorel.classes.IncFile | ||
pybalmorel.classes.Balmorel | ||
pybalmorel.classes.TechData | ||
pybalmorel.classes.GUI | ||
|
||
|
||
Module Contents | ||
--------------- | ||
|
||
.. py:class:: MainResults(files: Union[str, list, tuple], paths: Union[str, list, tuple] = '.', scenario_names: Union[str, list, tuple] = None, system_directory: str = None, result_type: str = 'balmorel') | ||
.. py:attribute:: files | ||
.. py:attribute:: paths | ||
.. py:attribute:: sc | ||
.. py:attribute:: type | ||
.. py:attribute:: db | ||
.. py:method:: get_result(symbol: str, cols: Tuple[list, None] = None) -> pandas.DataFrame | ||
Get a certain result from the loaded gdx file(s) into a pandas DataFrame | ||
|
||
Args: | ||
symbol (str): The desired result, e.g. PRO_YCRAGF | ||
cols (str, optional): Specify custom columns. Defaults to pre-defined formats. | ||
|
||
Returns: | ||
pd.DataFrame: The output DataFrame | ||
|
||
|
||
|
||
.. py:method:: interactive_bar_chart(plot_style: str = 'light') | ||
GUI for bar chart plotting | ||
|
||
|
||
|
||
.. py:method:: plot_profile(commodity: str, year: int, scenario: str = 0, columns: str = 'Technology', region: str = 'ALL', style: str = 'light') -> Tuple[matplotlib.figure.Figure, matplotlib.axes.Axes] | ||
Plots the production profile of a commodity, in a year, for a certain scenario | ||
|
||
Args: | ||
commodity (str): The commodity (Electricity, Heat or Hydrogen) | ||
year (int): The model year to plot | ||
scenario (str, optional): Defaults to the first scenario in MainResults. | ||
columns (str, optional): Technology or Fuel as . Defaults to 'Technology'. | ||
region (str, optional): Which country, region or area to plot. Defaults to 'ALL'. | ||
style (str, optional): Plot style, light or dark. Defaults to 'light'. | ||
|
||
Returns: | ||
Figure, Axes: The figure and axes objects for further manipulations | ||
|
||
|
||
|
||
.. py:method:: plot_map(scenario: str, commodity: str, year: int, path_to_geofile: str = None, bypass_path: str = None, geo_file_region_column: str = 'id', style: str = 'light') -> Tuple[matplotlib.figure.Figure, matplotlib.axes.Axes] | ||
Plots the transmission capacities in a scenario, of a certain commodity | ||
|
||
Args: | ||
path_to_result (str): Path to the .gdx file | ||
scenario (str): The scenario name | ||
commodity (str): Electricity or hydrogen | ||
year (int): Model year | ||
path_to_geofile (str, optional): The path to the fitting geofile. Defaults to '../geofiles/2024 BalmorelMap.geojson' in package directory. | ||
bypass_path (str, optional): Extra coordinates for transmission lines for beauty. Defaults to '../geofiles/bypass_lines' in package directory. | ||
geo_file_region_column (str, optional): The columns containing the region names of MainResults. Defaults to 'id'. | ||
style (str, optional): Plot style. Defaults to 'light'. | ||
|
||
Returns: | ||
Tuple[Figure, Axes]: The figure and axes objects of the plot | ||
|
||
|
||
|
||
.. py:method:: _existing_func_wrapper(function, *args, **kwargs) | ||
.. py:class:: IncFile(prefix: str = '', body: str = '', suffix: str = '', name: str = 'name', path: str = 'Balmorel/base/data/') | ||
A useful class for creating .inc-files for GAMS models | ||
Args: | ||
prefix (str): The first part of the .inc file. | ||
body (str): The main part of the .inc file. | ||
suffix (str): The last part of the .inc file. | ||
name (str): The name of the .inc file. | ||
path (str): The path to save the file, defaults to 'Balmorel/base/data'. | ||
|
||
|
||
.. py:attribute:: prefix | ||
.. py:attribute:: body | ||
.. py:attribute:: suffix | ||
.. py:attribute:: name | ||
.. py:attribute:: path | ||
.. py:method:: body_concat(df: pandas.DataFrame) | ||
Concatenate a body temporarily being a dataframe to another dataframe | ||
|
||
|
||
|
||
|
||
.. py:method:: body_prepare(index: list, columns: list, values: str = 'Value', aggfunc: str = 'sum', fill_value: Union[str, int] = '') | ||
.. py:method:: save() | ||
.. py:class:: Balmorel(model_folder: str, gams_system_directory: str = None) | ||
A class that recognises the Balmorel folder structure, can be used to run scenarios or results | ||
|
||
Args: | ||
model_folder (str): The top level folder of Balmorel, where base and simex are located | ||
|
||
|
||
.. py:attribute:: _gams_system_directory | ||
.. py:attribute:: path | ||
.. py:attribute:: scenarios | ||
:value: [] | ||
|
||
|
||
|
||
.. py:attribute:: input_data | ||
.. py:method:: locate_results() | ||
Locates results, which is faster than collecting them if you just want an overview | ||
|
||
|
||
|
||
.. py:method:: collect_results() | ||
Collects results | ||
|
||
|
||
|
||
.. py:method:: run(scenario: str, cmd_line_options: dict = {}) | ||
.. py:method:: load_incfiles(scenario: str = 'base', use_provided_read_files: bool = True, read_file: str = 'Balmorel_ReadData', overwrite: bool = False) | ||
Will load .inc files from the specific scenario | ||
|
||
Args: | ||
scenario (str, optional): The scenario that you . Defaults to 'base'. | ||
use_provided_read_files (bool, optional): Use provided Balmorel_ReadData.gms and Balmorelbb4_ReadData.inc. Defaults to True. | ||
read_file (str, optional): The name of the read file to be executed. Defaults to Balmorel_ReadData | ||
overwrite (bool, optional): Will overwrite an existing %scenario%_input_data.gdx file from a previous .load_incfiles execution | ||
|
||
Raises: | ||
KeyError: _description_ | ||
|
||
|
||
|
||
.. py:class:: TechData | ||
.. py:attribute:: files | ||
:type: dict | ||
|
||
|
||
.. py:attribute:: path | ||
:type: str | ||
:value: 'C:\\Users\\mathi\\gitRepos\\balmorel-preprocessing\\RawDataProcessing\\Data\\Technology Data' | ||
|
||
|
||
|
||
.. py:method:: load(file: str) | ||
.. py:method:: download_file(url, save_folder, filename=None) | ||
Downloads a file from a given URL and saves it to a specified folder. | ||
Args: | ||
url (str): The URL of the file to download. | ||
save_folder (str): The folder where the file should be saved. | ||
filename (str, optional): The name to save the file as. If not provided, the filename is extracted from the URL. | ||
Returns: | ||
str: The full path to the saved file. | ||
Raises: | ||
requests.exceptions.RequestException: If the download fails. | ||
Notes: | ||
- The function ensures that the save folder exists. | ||
- The file is downloaded in chunks to handle large files efficiently. | ||
chunk_size: | ||
The size of each chunk of data to be written to the file. In this case, it is set to 8192 bytes (8 KB). | ||
|
||
|
||
|
||
.. py:method:: download_catalogue(file: str, save_to_folder: str = '.', domain: str = 'https://ens.dk/sites/ens.dk/files/Analyser/') | ||
Downloads technology catalogue from DEA website | ||
|
||
Args: | ||
file (str): _description_ | ||
save_to_folder (str, optional): _description_. Defaults to '.'. | ||
domain (_type_, optional): _description_. Defaults to "https://ens.dk/sites/ens.dk/files/Analyser/". | ||
|
||
|
||
|
||
.. py:method:: download_all_catalogues(save_to_folder: str = '.') | ||
.. py:class:: GUI | ||
.. py:method:: bar_chart(MainResults_instance) | ||
Interactive GUI to plot bar charts from MainResults | ||
|
||
Args: | ||
MainResults_instance (class): Loaded MainResults | ||
|
||
Returns: | ||
None: An interactive GUI is opened to plot bar charts | ||
|
||
|
||
|
||
.. py:method:: geofilemaker() | ||
Opens a GUI to interactively generate necessary .inc files for Balmorel geography | ||
|
||
Returns: | ||
None: An interactive GUI to generate geographic .inc files | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
pybalmorel.formatting | ||
===================== | ||
|
||
.. py:module:: pybalmorel.formatting | ||
.. autoapi-nested-parse:: | ||
|
||
Created on 03.06.2024 | ||
|
||
@author: Mathias Berg Rosendal, PhD Student at DTU Management (Energy Economics & Modelling) | ||
|
||
|
||
|
||
Attributes | ||
---------- | ||
|
||
.. autoapisummary:: | ||
|
||
pybalmorel.formatting.tech_colours | ||
pybalmorel.formatting.fuel_colours | ||
pybalmorel.formatting.balmorel_colours | ||
pybalmorel.formatting.mberos_colours | ||
pybalmorel.formatting.balmorel_symbol_columns | ||
pybalmorel.formatting.balmorel_mainresults_symbol_columns | ||
pybalmorel.formatting.optiflow_symbol_columns | ||
pybalmorel.formatting.optiflow_mainresults_symbol_columns | ||
|
||
|
||
Module Contents | ||
--------------- | ||
|
||
.. py:data:: tech_colours | ||
.. py:data:: fuel_colours | ||
.. py:data:: balmorel_colours | ||
.. py:data:: mberos_colours | ||
.. py:data:: balmorel_symbol_columns | ||
.. py:data:: balmorel_mainresults_symbol_columns | ||
.. py:data:: optiflow_symbol_columns | ||
.. py:data:: optiflow_mainresults_symbol_columns | ||
Oops, something went wrong.