Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Features/update tabular #335

Merged
merged 67 commits into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from 66 commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
c7c2900
Update python version range in pyproject.toml
Stefanie08 Jul 27, 2023
5bb0688
Update oemoflex version in pyproject.toml
Stefanie08 Jul 27, 2023
86957af
Specify boto3 version in pyproject.toml
Stefanie08 Jul 27, 2023
98f131e
Update poetry.lock
Stefanie08 Jul 27, 2023
912d860
Use .items() instead of .iteritems() due to pandas upgrade
Stefanie08 Jul 27, 2023
01eba71
Convert ts_raw.index to datetime format
Stefanie08 Jul 27, 2023
750641b
Fix wacc bug
Stefanie08 Jul 31, 2023
9a55f7b
Use COP ts name from component_attrs_update instead of hardcoding it
MaGering Aug 2, 2023
7b67b1a
Define datetime format saving ts since new pandas version dropped HH:…
MaGering Aug 2, 2023
851e965
Use equate_flows from oemof.solph
MaGering Aug 2, 2023
b103fee
Delete redundant oemof_b3/tools/equate_flows.py
MaGering Aug 2, 2023
e635639
Fix pandas.testing import
MaGering Aug 2, 2023
f99f017
Update expected updated scenario test csv since new pandas version ap…
MaGering Aug 2, 2023
66377ac
Fix test_prepare_vehicle_charging_demand_smoothing
MaGering Aug 3, 2023
4417df6
Fix test_prepare_vehicle_charging_demand
MaGering Aug 3, 2023
3268b35
Fix test_df_agg_sc
MaGering Aug 3, 2023
ebf3433
Fix test_oemof_results_flows_to_b3_ts
MaGering Aug 3, 2023
513cfb7
Update python version in .github/workflows/main.yml
MaGering Aug 3, 2023
5958e76
Update python version in .github/workflows/main.yml
MaGering Aug 7, 2023
338f8ba
Update python version in pyproject.toml
MaGering Aug 7, 2023
78c1102
Update poetry lock file
MaGering Aug 7, 2023
c3c7192
Update python version in environment.yml
MaGering Aug 7, 2023
662159c
Fix timeincrement in optimize.py
MaGering Aug 7, 2023
de3ed13
Fix python version in .github/workflows/main.yml
MaGering Aug 7, 2023
43d57df
Delete redundant python version in pyprojec.toml
MaGering Aug 10, 2023
de1f14b
Update poetry lock file
MaGering Aug 10, 2023
b696cb9
Update poetry lock file
MaGering Aug 14, 2023
35d345e
Update poetry lock file
MaGering Aug 14, 2023
191f8f0
Update poetry lock file
MaGering Aug 15, 2023
95f4269
Correct pandas command for python 3.10
Stefanie08 Aug 15, 2023
aac3e7f
Correct pandas command for python 3.10
Stefanie08 Aug 15, 2023
34da9b0
Fix create_empty_scalars.py
MaGering Aug 15, 2023
856ccd3
Merge branch 'features/update_tabular' of github.com:rl-institut/oemo…
MaGering Aug 15, 2023
85c3d6c
Update poetry lock
MaGering Aug 16, 2023
7a652d8
Fix merge conflict
Stefanie08 Aug 24, 2023
4ce24ae
Fix pd.concat function in table_costs_efficiencies.py
Stefanie08 Aug 24, 2023
29e4345
Fix pd.read_csv to extract year in line 150 in plot_storage_levels.py
Stefanie08 Aug 24, 2023
12bd51c
Use .items() instead of .iteritems() due to pandas upgrade
Stefanie08 Aug 24, 2023
cac108c
Revert "Fix pd.read_csv to extract year in line 150 in plot_storage_l…
MaGering Aug 30, 2023
aa167f2
Apply black
MaGering Aug 30, 2023
65b97d0
Fix examples
MaGering Aug 30, 2023
ecc4ba2
Add oem2orm to poetry
MaGering Aug 31, 2023
e491774
Revert "Add oem2orm to poetry"
MaGering Aug 31, 2023
7410355
Merge branch 'dev' into features/update_tabular
MaGering Aug 31, 2023
b856ad6
Merge branch 'dev' into features/update_tabular
MaGering Aug 31, 2023
ca67993
Merge branch 'fix/geopandas_future_warning' into features/update_tabular
Stefanie08 Sep 7, 2023
ddaa914
Merge branch 'dev' into features/update_tabular
MaGering Sep 11, 2023
d9ef883
Merge branch 'features/update_tabular' of github.com:rl-institut/oemo…
Stefanie08 Sep 11, 2023
c80b48f
Merge branch 'dev' into features/update_tabular
Stefanie08 Sep 11, 2023
b925e0b
Delete snake.log and apply black
Stefanie08 Sep 11, 2023
29df844
Change oemoflex version to dev after release of v0.0.2
MaGering Sep 20, 2023
37135b8
Delete snake.log file which has been accidentally added
MaGering Sep 20, 2023
e27e779
Reformat Installation info in README.md
MaGering Sep 20, 2023
599b0cc
Update and fix README.md
SabineHaas Sep 20, 2023
f57a304
Update getting_started.rst
SabineHaas Sep 20, 2023
a5bda1d
Reformat Installation info getting_started.rst
MaGering Sep 20, 2023
974487b
Merge branch 'features/update_tabular' of github.com:rl-institut/oemo…
MaGering Sep 20, 2023
06ca4c5
Update installation info
MaGering Sep 20, 2023
fcef36c
Update installation info
MaGering Sep 20, 2023
3ba18d6
Fix poetry installation prompt
MaGering Sep 20, 2023
5f8ffac
Fix Netzentwicklungsplan ref in examples.rst
MaGering Sep 20, 2023
605a7e4
Fix link to facades in model_pipeline.rst
MaGering Sep 20, 2023
79dc7ae
Add link to customize oemof-B3 section in getting_started.rst
MaGering Sep 20, 2023
ae45e1e
Revert "Add link to customize oemof-B3 section in getting_started.rst"
MaGering Sep 20, 2023
d11d5e9
Revert "Revert "Add link to customize oemof-B3 section in getting_sta…
MaGering Sep 20, 2023
492e091
Fix customize label in getting_started.rst
MaGering Sep 20, 2023
145e123
Update pyproject.toml
MaGering Sep 20, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ 3.8 ]
python-version: [ '3.8', '3.9', '3.10']

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
Expand Down
34 changes: 26 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,33 @@ In the documentation you will find instructions on how to run the scenarios with

### Installation

Currently, oemof-B3 needs python 3.7 or 3.8 (newer versions may be supported, but installation can take very long).
Currently, oemof-B3 needs python 3.8, 3.9 or 3.10 (newer versions may be supported, but installation can take very long).

In order to install oemof-B3, proceed with the following steps:
Additionally, you need to install the python dependency manager [poetry](https://python-poetry.org/).
It is recommended to install poetry system-wide via the command below or
[pipx](https://python-poetry.org/docs/#installing-with-pipx):

- git-clone oemof-B3 into local folder: `git clone https://github.com/rl-institut/oemof-B3.git`
- enter folder
- create virtual environment using conda: `conda env create environment.yml`
- activate environment: `conda activate oemof-B3`
- install oemof-B3 package using poetry, via: `poetry install`
curl -sSL https://install.python-poetry.org | python3 -
poetry install


**In order to install oemof-B3, proceed with the following steps:**

1. Clone oemof-B3 into local folder:

git clone git@github.com:rl-institut/oemof-B3.git
2. Enter folder

cd oemof-B3
3. Create virtual environment using conda:

conda env create environment.yml
4. Activate environment:

conda activate oemof-B3
5. Install oemof-B3 package using poetry, via:

poetry install

Alternatively, you can create a virtual environment using other approaches, such as `virtualenv`.

Expand All @@ -46,7 +64,7 @@ If environment is build otherwise, pandoc must be installed manually. It can be

For the optimization, oemof-B3 needs a solver. Check out the [oemof.solph](https://oemof-solph.readthedocs.io/en/latest/readme.html#installing-a-solver) documentation for installation notes.

To test if everything works, you can run the examples (cf. :ref:`How to run the model`).
To test if everything works, you can run the [examples](https://oemof-b3.readthedocs.io/en/latest/examples.html).

For developers: Please activate pre-commit hooks (via `pre-commit install`) in order to follow our coding styles.

Expand Down
2 changes: 1 addition & 1 deletion docs/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ The examples are limited to the electricity sector, the heat sector is not model

Data for capacities of wind, photovoltaic and biomass as well as electricity demand have been taken
from the grid development plan
(`Netzentwicklungsplan <https://www.netzentwicklungsplan.de/sites/default/files/paragraphs-files/NEP_2035_V2021_1_Entwurf_Teil1.pdf>`_, p. 41 ff.)
(`Netzentwicklungsplan <https://www.netzentwicklungsplan.de/sites/default/files/2022-11/NEP_2035_V2021_1_Entwurf_Teil1_1.pdf>`_, p. 41 ff.)
:cite:`NEP2021_Entwurf_1`.
Data for efficiencies and costs (specific annuity, fuel costs) are based on different sources as well
as on own assumptions.
Expand Down
50 changes: 42 additions & 8 deletions docs/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,49 @@ Using oemof-B3
Installation
------------

Currently, oemof-B3 needs python 3.7 or 3.8 (newer versions may be supported, but installation can take very long).
Currently, oemof-B3 needs python 3.8, 3.9 or 3.10 (newer versions may be supported, but installation can take very long).

In order to install oemof-B3, proceed with the following steps:
Additionally, you need to install the python dependency manager `poetry <https://python-poetry.org/>`_.
It is recommended to install poetry system-wide via the command below or
`pipx <https://python-poetry.org/docs/#installing-with-pipx>`_:

- git-clone oemof-B3 into local folder: `git clone https://github.com/rl-institut/oemof-B3.git`
- enter folder
- create virtual environment using conda: `conda env create environment.yml`
- activate environment: `conda activate oemof-B3`
- install oemof-B3 package using poetry, via: `poetry install`
::

curl -sSL https://install.python-poetry.org | python3 -
poetry install


**In order to install oemof-B3, proceed with the following steps:**

1. Clone oemof-B3 into local folder:

::

git clone git@github.com:rl-institut/oemof-B3.git

2. Enter folder

::

cd oemof-B3

3. Create virtual environment using conda:

::

conda env create environment.yml

4. Activate environment:

::

conda activate oemof-B3

5. Install oemof-B3 package using poetry, via:

::

poetry install

Alternatively, you can create a virtual environment using other approaches, such as `virtualenv`.

Expand Down Expand Up @@ -163,7 +197,7 @@ of the componentes in the subdirectory oemof_b3 can be done.
But you can also modify oemof_b3 to define your own energy system of another city or district.
For all these use cases, the data in the raw directory
must be adapted. For this purpose, it is advisable to have energy system-specific empty scalar data
and time series created for each scenario.
and time series created for each scenario. See further information in :ref:`How to customize oemof-B3`.

Executing the rule

Expand Down
2 changes: 1 addition & 1 deletion docs/model_pipeline.rst
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ A few more conventions are important to know:
* The capacity of specific components of a scenario can be expanded during an optimization, if the facade attribute `expandable` is set on `True`.

* To adjust this setting, the attribute needs to be specified in the file :attr:`costs_efficiencies.csv`.
* An overview of all facades, which includes `expandable` can be found in the facade attributes overview <https://oemof-tabular.readthedocs.io/en/latest/facades.html#>`_ provided by oemof.tabular.
* An overview of all facades, which includes `expandable`, can be found in the `facade attributes overview <https://oemof-tabular.readthedocs.io/en/latest/facades.html#>`_ provided by oemof.tabular.

* There is a distinction between the maximum capacity and the already installed capacity of specific components.
Both of the two attributes can be set individually:
Expand Down
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ channels:
- defaults
- conda-forge
dependencies:
- python=3.8
- python=3.10
- conda-forge::pandoc>=2.17
- pip
- pip:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
region,name,type,carrier,tech,bus,capacity,marginal_cost,output_parameters
BE,BE-electricity-shortage,shortage,electricity,shortage,BE-electricity,,100000,{}
BB,BB-electricity-shortage,shortage,electricity,shortage,BB-electricity,,100000,{}
BE,BE-electricity-shortage,shortage,electricity,shortage,BE-electricity,10000000,410,{}
BB,BB-electricity-shortage,shortage,electricity,shortage,BB-electricity,10000000,410,{}
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
region,name,type,carrier,tech,bus,capacity,marginal_cost,output_parameters
BE,BE-electricity-shortage,shortage,electricity,shortage,BE-electricity,,100000,{}
BB,BB-electricity-shortage,shortage,electricity,shortage,BB-electricity,,100000,{}
BE,BE-electricity-shortage,shortage,electricity,shortage,BE-electricity,10000000,410,{}
BB,BB-electricity-shortage,shortage,electricity,shortage,BB-electricity,10000000,410,{}
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
region,name,type,carrier,tech,bus,capacity,marginal_cost,output_parameters
BE,BE-electricity-shortage,shortage,electricity,shortage,BE-electricity,,100000,{}
BB,BB-electricity-shortage,shortage,electricity,shortage,BB-electricity,,100000,{}
BE,BE-electricity-shortage,shortage,electricity,shortage,BE-electricity,10000000,410,{}
BB,BB-electricity-shortage,shortage,electricity,shortage,BB-electricity,10000000,410,{}
2 changes: 1 addition & 1 deletion oemof_b3/schema/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def write_schema_to_metadata(schema, metadata, num_resource=0):
"description"
] = schema.index["description"]

for i, (name, (type, description)) in enumerate(schema.columns.iteritems()):
for i, (name, (type, description)) in enumerate(schema.columns.items()):
_metadata["resources"][num_resource]["schema"]["fields"][i + 1]["name"] = name
_metadata["resources"][num_resource]["schema"]["fields"][i + 1]["type"] = type
_metadata["resources"][num_resource]["schema"]["fields"][i + 1][
Expand Down
14 changes: 11 additions & 3 deletions oemof_b3/tools/data_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,12 @@ def save_df(df, path):
Path to save the csv file
"""
# Save scalars to csv file
df.to_csv(path, index=True, sep=config.settings.general.separator)
df.to_csv(
path,
index=True,
sep=config.settings.general.separator,
date_format="%Y-%m-%d %H:%M:%S",
)

# Print user info
logger.info(f"The DataFrame has been saved to: {path}.")
Expand Down Expand Up @@ -517,7 +522,7 @@ def aggregate_scalars(df, columns_to_aggregate, agg_method=None):
if not agg_method:
agg_method = {
"var_value": sum,
"name": lambda x: "None",
"name": lambda x: np.nan,
"var_unit": aggregate_units,
}

Expand Down Expand Up @@ -1254,7 +1259,10 @@ def _get_direction(oemof_tuple):

def _get_region_carrier_tech_from_component(component, delimiter="-"):

if isinstance(component, oemof.tabular.facades.Facade):
typemap_facades = oemof.tabular.facades.TYPEMAP
typemap_values = list(typemap_facades.values())

if isinstance(component, classmethod) and (component in typemap_values):
region = component.region
carrier = component.carrier
tech = component.tech
Expand Down
60 changes: 0 additions & 60 deletions oemof_b3/tools/equate_flows.py

This file was deleted.

Loading
Loading