From d5c7c6d3e2f13f2772d3ceb2aae40f3638603cb9 Mon Sep 17 00:00:00 2001 From: Mathias157 Date: Sun, 20 Oct 2024 15:56:12 +0200 Subject: [PATCH] Improving docs --- docs/examples/execution.md | 2 +- docs/examples/postprocessing.md | 43 ++++++++++++++++++++++++++++++++- docs/examples/preprocessing.md | 2 +- 3 files changed, 44 insertions(+), 3 deletions(-) diff --git a/docs/examples/execution.md b/docs/examples/execution.md index 2cf7df8..58da92c 100644 --- a/docs/examples/execution.md +++ b/docs/examples/execution.md @@ -1,6 +1,6 @@ # Execution -The 'Balmorel' class can also be used to run Balmorel scenarios. +The 'Balmorel' class can also be used to run Balmorel scenarios. Check out [this notebook](https://github.com/Mathias157/pybalmorel/blob/master/examples/Execution.ipynb) or the examples below. ```python from pybalmorel import Balmorel diff --git a/docs/examples/postprocessing.md b/docs/examples/postprocessing.md index 6b92bac..57ccfe4 100644 --- a/docs/examples/postprocessing.md +++ b/docs/examples/postprocessing.md @@ -1,3 +1,44 @@ # Post-Processing -There are several functions to plot energy balances, transmission capacity maps and a ipywidget to interactively plot bar charts, check out [this notebook](https://github.com/Mathias157/pybalmorel/blob/master/examples/PostProcessing.ipynb). \ No newline at end of file +There are several functions to plot energy balances, transmission capacity maps and a ipywidget to interactively plot bar charts, check out [this notebook](https://github.com/Mathias157/pybalmorel/blob/master/examples/PostProcessing.ipynb). + +The example below uses the Balmorel class to load results. + +## Interactively Plotting All Results +```python +from pybalmorel import Balmorel + +# Load Balmorel +model = Balmorel('path/to/Balmorel') + +# Collect results +model.collect_results() + +# Plot bar charts with an interactive GUI +model.results.interactive_bar_chart() +``` + +## Transmission Maps and Energy Balances + +Using the collected results below, the examples below illustrate how to plot figures of transmission capacities and save them. + +```python +# Plot electricity transmission capacities in the first scenario, year 2050 +model.results.plot_map(model.results.sc[0], 'electricity', 2050) + +# Plot total heat energy balance in the second scenario, year 2050 +model.results.plot_profile('heat', 2050, model.results.sc[1]) +``` + +## Getting Specific Results +The `model.results` is actually a `MainResults` class. The example below illustrates how to get specific results using that class. + +```python +from pybalmorel import MainResults + +mainresults_files = ['MainResults_SC1.gdx', 'MainResults_SC2.gdx'] +paths = ['path/to/folder/with/SC1', 'path/to/folder/with/SC2'] +results = MainResults(mainresults_files, paths=paths) +``` + +If the files are in the same folder, you just need to input a single path to the paths argument. The class will name the scenarios 'SC1' and 'SC2' by default and store them in a list in `results.sc`, but you can also provide your own names with the scenario_names argument. \ No newline at end of file diff --git a/docs/examples/preprocessing.md b/docs/examples/preprocessing.md index 3584f66..e3b5dd1 100644 --- a/docs/examples/preprocessing.md +++ b/docs/examples/preprocessing.md @@ -1,6 +1,6 @@ # Pre-Processing -The examples below show how to create single .inc-files, loading all .inc files using the Balmorel class, and defining geography using an interactive GUI. +The examples below show how to create single .inc-files, loading all .inc files using the Balmorel class, and defining geography using an interactive GUI. A [notebook](https://github.com/Mathias157/pybalmorel/blob/master/examples/PreProcessing.ipynb) can also be downloaded from the GitHub repository. ## Create an .inc File The 'IncFile' class is a handy class for creating .inc files that are the input for Balmorel.