Skip to content

Commit

Permalink
Merge branch 'features/#1095-mastr-status-quo' into continuous-integr…
Browse files Browse the repository at this point in the history
…ation/run-everything-2022-11-10
  • Loading branch information
khelfen committed Mar 2, 2023
2 parents 180641e + 2537a0f commit 191fa14
Show file tree
Hide file tree
Showing 9 changed files with 760 additions and 930 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.rst
Expand Up @@ -252,6 +252,8 @@ Added
`PR #903 <https://github.com/openego/eGon-data/pull/903>`_
* Add low flex scenario 'eGon2035_lowflex'
`#822 <https://github.com/openego/eGon-data/issues/822>`_
* Add MaStR geocoding and handling of conventional generators
`#1095 <https://github.com/openego/eGon-data/issues/1095>`_

.. _PR #159: https://github.com/openego/eGon-data/pull/159
.. _PR #703: https://github.com/openego/eGon-data/pull/703
Expand Down Expand Up @@ -496,9 +498,14 @@ Changed
`#1073 <https://github.com/openego/eGon-data/issues/1073>`_
* Rename eMob MIT carrier names (use underscores)
`#1105 <https://github.com/openego/eGon-data/issues/1105>`_
* Change desposit ID for data_bundle download from zenodo sandbox
`#1110 <https://github.com/openego/eGon-data/issues/1110>`_
* Use MaStR geocoding results for pv rooftop to buildings mapping workflow
`#1095 <https://github.com/openego/eGon-data/issues/1095>`_

.. _#799: https://github.com/openego/eGon-data/issues/799


Bug Fixes
---------

Expand Down
12 changes: 12 additions & 0 deletions docs/data.rst
Expand Up @@ -7,3 +7,15 @@ Scenarios

Published data
==============

Data bundle
-----------

The data bundle is published on
`zenodo <https://sandbox.zenodo.org/record/1167119>`_. It contains several data
sets, which serve as a basis for egon-data. One such data set is the geocoding
for the `MaStR data set <https://sandbox.zenodo.org/record/1132987>`_ which is
used for eGon-data as well. Whenever the MaStR data set is updated it is
necessary to redo the geocoding with the new data set and update the data
bundle accordingly. The geocoding can be done based on the
`mastr-geocoding repository <https://github.com/RLI-sandbox/mastr-geocoding>`_.
23 changes: 16 additions & 7 deletions src/egon/data/datasets.yml
Expand Up @@ -299,13 +299,20 @@ mastr:

mastr_new:
technologies:
- "wind"
- "biomass"
- "combustion"
- "gsgk"
- "hydro"
- "nuclear"
- "solar"
- "biomass"
- "storage"
- "wind"
file_basename: "bnetza_mastr"
deposit_id: 1132987
egon2021_date_max: "2021-12-31 23:59:00"
geocoding_path:
- "data_bundle_egon_data"
- "mastr_geocoding"

re_potential_areas:
target:
Expand Down Expand Up @@ -356,14 +363,16 @@ hotmaps_current_policy_scenario_heat_demands_buildings:

power_plants:
sources:
mastr_pv: "bnetza_mastr_solar_cleaned.csv"
mastr_wind: "bnetza_mastr_wind_cleaned.csv"
mastr_biomass: "bnetza_mastr_biomass_cleaned.csv"
mastr_combustion: "bnetza_mastr_combustion_cleaned.csv"
mastr_combustion_without_chp: "supply.egon_mastr_conventional_without_chp"
mastr_gsgk: "bnetza_mastr_gsgk_cleaned.csv"
mastr_hydro: "bnetza_mastr_hydro_cleaned.csv"
mastr_location: "location_elec_generation_raw.csv"
mastr_combustion_without_chp: "supply.egon_mastr_conventional_without_chp"
mastr_nuclear: "bnetza_mastr_nuclear_cleaned.csv"
mastr_pv: "bnetza_mastr_solar_cleaned.csv"
mastr_storage: "bnetza_mastr_storage_cleaned.csv"
mastr_gsgk: "bnetza_mastr_gsgk_cleaned.csv"
mastr_wind: "bnetza_mastr_wind_cleaned.csv"
capacities: "supply.egon_scenario_capacities"
geom_germany: "boundaries.vg250_sta_union"
geom_federal_states: "boundaries.vg250_lan"
Expand Down Expand Up @@ -531,7 +540,7 @@ solar_rooftop:
data-bundle:
sources:
zenodo:
deposit_id: 1095882
deposit_id: 1167119
targets:
file:
'data_bundle_egon_data.zip'
Expand Down
25 changes: 14 additions & 11 deletions src/egon/data/datasets/data_bundle/__init__.py
Expand Up @@ -2,13 +2,13 @@
"""


from pathlib import Path
from urllib.request import urlretrieve
import shutil
import zipfile

import egon.data.config
from egon.data import config
from egon.data.datasets import Dataset
from pathlib import Path
import shutil


def download():
Expand All @@ -23,9 +23,12 @@ def download():
if data_bundle_path.exists() and data_bundle_path.is_dir():
shutil.rmtree(data_bundle_path)
# Get parameters from config and set download URL
sources = egon.data.config.datasets()["data-bundle"]["sources"]["zenodo"]
url = f"""https://sandbox.zenodo.org/record/{sources['deposit_id']}/files/data_bundle_egon_data.zip"""
target_file = egon.data.config.datasets()["data-bundle"]["targets"]["file"]
sources = config.datasets()["data-bundle"]["sources"]["zenodo"]
url = (
f"https://sandbox.zenodo.org/record/{sources['deposit_id']}/files/"
"data_bundle_egon_data.zip"
)
target_file = config.datasets()["data-bundle"]["targets"]["file"]

# Retrieve files
urlretrieve(url, target_file)
Expand All @@ -36,12 +39,12 @@ def download():

class DataBundle(Dataset):
def __init__(self, dependencies):
deposit_id = egon.data.config.datasets()["data-bundle"]["sources"][
"zenodo"
]["deposit_id"]
deposit_id = config.datasets()["data-bundle"]["sources"]["zenodo"][
"deposit_id"
]
super().__init__(
name="DataBundle",
version=str(deposit_id) + "-0.0.0",
version=f"{deposit_id}-0.0.1",
dependencies=dependencies,
tasks=(download),
tasks=(download,),
)
7 changes: 4 additions & 3 deletions src/egon/data/datasets/power_plants/__init__.py
Expand Up @@ -29,7 +29,6 @@
)
from egon.data.datasets.power_plants.pv_rooftop import pv_rooftop_per_mv_grid
from egon.data.datasets.power_plants.pv_rooftop_buildings import (
geocode_mastr_data,
pv_rooftop_to_buildings,
)
import egon.data.config
Expand Down Expand Up @@ -73,7 +72,6 @@ def __init__(self, dependencies):
pv_ground_mounted.insert,
(
pv_rooftop_per_mv_grid,
geocode_mastr_data,
pv_rooftop_to_buildings,
),
},
Expand Down Expand Up @@ -111,7 +109,10 @@ def create_tables():
]
for t in tables:
db.execute_sql(
f"DROP TABLE IF EXISTS {t.__table_args__['schema']}.{t.__tablename__} CASCADE;"
f"""
DROP TABLE IF EXISTS {t.__table_args__['schema']}.
{t.__tablename__} CASCADE;
"""
)
t.__table__.create(bind=engine, checkfirst=True)

Expand Down

0 comments on commit 191fa14

Please sign in to comment.