Skip to content

Commit

Permalink
Merge branch 'dev' into features/#1014-load-areas
Browse files Browse the repository at this point in the history
  • Loading branch information
nesnoj committed Nov 1, 2022
2 parents 6782413 + 8f094a6 commit 569c083
Show file tree
Hide file tree
Showing 16 changed files with 824 additions and 151 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -417,17 +417,24 @@ Changed
`#866 <https://github.com/openego/eGon-data/issues/866>`_
* Add noflex scenario for motorized individual travel
`#821 <https://github.com/openego/eGon-data/issues/821>`_
* Allocate PV home batteries to mv grid districts
`#749 <https://github.com/openego/eGon-data/issues/749>`_
* Add sanity checks for motorized individual travel
`#820 <https://github.com/openego/eGon-data/issues/820>`_
* Parallelize sanity checks
`#882 <https://github.com/openego/eGon-data/issues/882>`_
* Insert crossboarding gas pipeline with Germany in eGon100RE
`#881 <https://github.com/openego/eGon-data/issues/881>`_
* Rename noflex to lowflex scenario for motorized individual travel
`#921 <https://github.com/openego/eGon-data/issues/921>`_
* Update creation of heat demand timeseries
`#857 <https://github.com/openego/eGon-data/issues/857>`_
`#856 <https://github.com/openego/eGon-data/issues/856>`_
* Introduce carrier name 'others'
`#819 <https://github.com/openego/eGon-data/issues/819>`_
* Add rural heat pumps per medium voltage grid district
`#987 <https://github.com/openego/eGon-data/issues/987>`_


Bug Fixes
---------
Expand Down
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
from glob import glob
from os.path import basename, dirname, join, splitext
import io
import re

import re
from setuptools import find_packages, setup


Expand Down
19 changes: 11 additions & 8 deletions src/egon/data/airflow/dags/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,14 +372,6 @@
]
)

# Gas abroad
gas_abroad_insert_data = GasNeighbours(
dependencies=[
gas_grid_insert_data,
foreign_lines,
]
)

# Insert hydrogen buses
insert_hydrogen_buses = HydrogenBusEtrago(
dependencies=[
Expand Down Expand Up @@ -423,6 +415,17 @@
dependencies=[create_gas_polygons_egon2035, insert_h2_grid, vg250]
)

# Gas abroad
gas_abroad_insert_data = GasNeighbours(
dependencies=[
gas_grid_insert_data,
run_pypsaeursec,
foreign_lines,
insert_hydrogen_buses,
create_gas_polygons_egon100RE
]
)

# Import gas production
gas_production_insert_data = CH4Production(
dependencies=[create_gas_polygons_egon2035]
Expand Down
3 changes: 3 additions & 0 deletions src/egon/data/datasets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,9 @@ storages:
egon_mv_grid_district: "grid.egon_mv_grid_district"
ehv_voronoi: "grid.egon_ehv_substation_voronoi"
nep_conv: "supply.egon_nep_2021_conventional_powerplants"
nep_capacities: "NEP2035_V2021_scnC2035.xlsx"
generators: "grid.egon_etrago_generator"
bus: "grid.egon_etrago_bus"
target:
table: 'egon_storages'
schema: 'supply'
Expand Down
36 changes: 28 additions & 8 deletions src/egon/data/datasets/gas_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,18 @@ def ch4_nodes_number_G(gas_nodes_list):

def insert_CH4_nodes_list(gas_nodes_list):
"""Insert list of CH4 nodes from SciGRID_gas IGGIELGN data
Parameters
Insert detailled description
Parameters
----------
gas_nodes_list : dataframe
Dataframe containing the gas nodes (Europe)
Returns
-------
None
"""
# Connect to local database
engine = db.engine()
Expand Down Expand Up @@ -220,7 +225,12 @@ def insert_CH4_nodes_list(gas_nodes_list):


def insert_gas_buses_abroad(scn_name="eGon2035"):
"""Insert central gas buses in foreign countries to db, same buses than the foreign AC buses
"""Insert central CH4 buses in foreign countries for eGon2035
Detailled description to be completed:
Insert central gas buses in foreign countries to db, same buses
than the foreign AC buses
Parameters
----------
scn_name : str
Expand All @@ -229,7 +239,8 @@ def insert_gas_buses_abroad(scn_name="eGon2035"):
Returns
-------
gdf_abroad_buses : dataframe
Dataframe containing the gas in the neighbouring countries and one in the center of Germany in test mode
Dataframe containing the CH4 buses in the neighbouring countries
and one in the center of Germany in test mode
"""
# Select sources and targets from dataset configuration
sources = config.datasets()["electrical_neighbours"]["sources"]
Expand Down Expand Up @@ -322,16 +333,22 @@ def insert_gas_pipeline_list(
gas_nodes_list, abroad_gas_nodes_list, scn_name="eGon2035"
):
"""Insert list of gas pipelines from SciGRID_gas IGGIELGN data
Insert detailled description
Parameters
----------
gas_nodes_list : dataframe
Dataframe containing the gas nodes (Europe)
description missing
abroad_gas_nodes_list: dataframe
description missing
scn_name : str
Name of the scenario
Returns
-------
None.
None
"""
abroad_gas_nodes_list = abroad_gas_nodes_list.set_index("country")

Expand Down Expand Up @@ -469,6 +486,7 @@ def insert_gas_pipeline_list(
c = ast.literal_eval(row["country_code"])
country_0.append(c[0])
country_1.append(c[1])

gas_pipelines_list["country_0"] = country_0
gas_pipelines_list["country_1"] = country_1

Expand Down Expand Up @@ -654,14 +672,16 @@ def insert_gas_pipeline_list(
]
)

# Insert data to db
# Clean db
db.execute_sql(
f"""DELETE FROM grid.egon_etrago_link WHERE "carrier" = '{main_gas_carrier}' AND
scn_name = '{scn_name}';
f"""DELETE FROM grid.egon_etrago_link
WHERE "carrier" = '{main_gas_carrier}'
AND scn_name = '{scn_name}';
"""
)

print(gas_pipelines_list)
# Insert data to db
gas_pipelines_list.to_postgis(
"egon_etrago_gas_link",
engine,
Expand Down
16 changes: 16 additions & 0 deletions src/egon/data/datasets/gas_neighbours/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""The central module containing all code dealing with gas neighbours
"""

from egon.data.datasets import Dataset
from egon.data.datasets.gas_neighbours.eGon2035 import tyndp_gas_generation, tyndp_gas_demand, grid
from egon.data.datasets.gas_neighbours.eGon100RE import insert_gas_neigbours_eGon100RE


class GasNeighbours(Dataset):
def __init__(self, dependencies):
super().__init__(
name="GasNeighbours",
version="0.0.1",
dependencies=dependencies,
tasks=({tyndp_gas_generation, tyndp_gas_demand, grid}, insert_gas_neigbours_eGon100RE),
)
Loading

0 comments on commit 569c083

Please sign in to comment.