Skip to content

Commit c710a5f

Browse files
author
IlkaCu
authored
Merge pull request #267 from openego/release/v0.4.0
Release/v0.4.0
2 parents e35e075 + be25177 commit c710a5f

254 files changed

Lines changed: 52871 additions & 10391 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md renamed to README.rst

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,25 @@
1-
# eGo dataprocessing
2-
(geo)data processing, database setup, data validation
1+
.. image:: https://readthedocs.org/projects/data-processing/badge/?version=feature-readthedocs
2+
:target: http://data-processing.readthedocs.io/en/latest/?badge=feature-readthedocs
3+
:alt: Documentation Status
4+
5+
.. image:: https://openegoproject.files.wordpress.com/2017/02/open_ego_logo_breit.png?w=400
6+
37

4-
# Copyleft
8+
===================
9+
eGo dataprocessing
10+
===================
511

12+
(geo)data processing, database setup, data validation
13+
14+
=========
15+
Copyleft
16+
=========
617
Code licensed under "GNU Affero General Public License Version 3 (AGPL-3.0)"
718
It is a collaborative work with several copyright owner:
819
Cite as "eGo dataprocessing © Flensburg University of Applied Sciences, Centre for Sustainable Energy Systems © Europa-Universität Flensburg, Centre for Sustainable Energy Systems © Reiner Lemoine Institut © DLR Institute for Networked Energy Systems"
920

10-
## Installation
21+
Installation
22+
============
1123

1224
Installation of latest release
1325

@@ -21,14 +33,17 @@ Installation (of developer version) via pip on linux systems as follows
2133
sudo pip3 install -e <path-to-data_processing-repo>
2234
```
2335

24-
### Troubleshooting
36+
Troubleshooting
37+
38+
On Windows
39+
***********
2540

26-
#### On Windows
2741
1. __Problem__: Installation of required package shapely fails. __Solution__: Install pre-build
2842
wheel from [here](http://www.lfd.uci.edu/~gohlke/pythonlibs/#shapely)
2943

3044

31-
## Run
45+
Run
46+
====
3247

3348
You can run data processing by calling command-line script
3449

bpmn/eGo_bpmn_palette.graphml

Lines changed: 0 additions & 2106 deletions
This file was deleted.

dataprocessing/eGo_data_processing.py

Lines changed: 62 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
Also see corresponding BPML diagram.
55
"""
66

7-
__copyright__ = "Reiner Lemoine Institut gGmbH"
7+
__copyright__ = "Reiner Lemoine Institut"
88
__license__ = "GNU Affero General Public License Version 3 (AGPL-3.0)"
99
__url__ = "https://github.com/openego/data_processing/blob/master/LICENSE"
1010
__author__ = "gplssm, Ludee"
@@ -40,67 +40,64 @@ def data_processing():
4040
'python_scripts'))
4141

4242
snippets = [
43-
## VACUUM FULL
44-
# 'ego_dp_vacuum_full.sql',
45-
46-
## INPUT DATA CHECK eGoPP
47-
'ego_dp_structure_input_verification.sql', # Check input tables and versions from eGoPP
48-
49-
## SUBSTATION
50-
'ego_dp_substation_hvmv.sql', # Abstract HVMV Substations of the high voltage level from OSM
51-
'ego_dp_substation_ehv.sql', # Abstract EHV Substations of the extra high voltage level from OSM
52-
'ego_dp_substation_otg.sql', # Assign osmTGmod-id to HVMV and EHV substations
53-
'ego_dp_substation_hvmv_voronoi.sql', # HVMV Voronoi cells based on HVMV substations
54-
'ego_dp_substation_ehv_voronoi.sql', # EHV Voronoi cells based on EHV substations
55-
56-
## GRIDDISTRICT
57-
'ego_dp_mv_griddistrict.sql', # MV Griddistricts from municipalities and Voronoi cells
58-
'ego_dp_substation_id_to_generator.sql', # Assign subst_id to pp lists
59-
60-
## LOADAREA
61-
'ego_dp_loadarea_landuse.sql', # OSM landuse sector
62-
'ego_dp_loadarea_industry_consumer.sql', # Industry consumer
63-
'ego_dp_loadarea_loads.sql', # Loads from OSM landuse
64-
'ego_dp_loadarea_census.sql', # Loads from Census
65-
'ego_dp_loadarea_loadmelt.sql', # Melt OSM landuse and Zensus loads
66-
'ego_dp_loadarea_loadcut_griddistrict.sql', # Cut Loadarea with MV Griddistrict
67-
'ego_dp_loadarea_loadcut_voronoi.sql', # Cut Loadarea with MV Voronoi cells
68-
'ego_dp_loadarea_consumption.sql', # Allocate consumption to Loadareas
69-
'ego_dp_loadarea_peakload.sql', # Peak loads per Loadarea
70-
'ego_dp_loadarea_griddistrict_results.sql', # Results for MV Griddistrict
71-
'ego_dp_loadarea_statistic.sql', # Results and statistics for eGoDP
72-
73-
## LOWVOLTAGE
74-
'ego_dp_lv_substation.sql', # MVLV Substation inside Loadarea
75-
'ego_dp_lv_substation_voronoi.sql', # MVLV Substation Voronoi
76-
'ego_dp_lv_griddistrict.sql', # LV Griddistrict
77-
'ego_dp_lv_peakload.sql', # LV OSM areas
78-
'ego_dp_lv_consumption_peakload.sql', # LV Consumption and Peakload
79-
80-
## REA
81-
'rea/ego_dp_lattice_500m.sql', # lattice (point grid) 500m
82-
'rea/ego_dp_lattice_50m.sql', # lattice (point grid) 50m
83-
'rea/ego_dp_rea_wpa_per_mvgd.sql', # wind potential area
84-
85-
'rea/ego_dp_rea_lattice_per_area_500m.sql', # prepare 500m lattice
86-
'rea/ego_dp_rea_lattice_per_area_50m.sql', # prepare 50m lattice
87-
'rea/ego_dp_rea_setup.sql', # setup table for allocation
88-
'rea/ego_dp_rea_m1.sql', # M1 biomass and solar to farmyard
89-
'rea/ego_dp_rea_m2.sql', # M2 windfarms
90-
'rea/ego_dp_rea_m3.sql', # M3 wind turbines to wpa
91-
'rea/ego_dp_rea_m4.sql', # M4 other and rest
92-
'rea/ego_dp_rea_m5.sql', # M5 LV to LA
93-
'rea/ego_dp_rea_results.sql', # results and statistics
94-
95-
## POWERFLOW
96-
'ego_dp_powerflow_assignment_otgid.sql', # assign otg_id to pp lists
97-
'ego_dp_powerflow_assignment_unid.sql', # create a unified_id over all pp (res and conv)
98-
'ego_dp_powerflow_create_pp_mview.sql', # create mviews to display power plants per scenario
99-
'ego_dp_powerflow_voronoi_weatherpoint.sql', # Create voronoi cells based on weather points
43+
## INPUT DATA CHECK (eGoPP)
44+
'ego_dp_structure_input_verification.sql', # Input verification (eGoPP)
45+
46+
## SUBSTATION
47+
'ego_dp_substation_hvmv.sql', # Abstract HVMV Substations of the high voltage level from OSM
48+
'ego_dp_substation_ehv.sql', # Abstract EHV Substations of the extra high voltage level from OSM
49+
'ego_dp_substation_otg.sql', # Assign osmTGmod-id to HVMV and EHV substations
50+
'ego_dp_substation_hvmv_voronoi.sql', # HVMV Voronoi cells based on HVMV substations
51+
'ego_dp_substation_ehv_voronoi.sql', # EHV Voronoi cells based on EHV substations
52+
53+
## GRIDDISTRICT
54+
'ego_dp_mv_griddistrict.sql', # MV GridDistricts from municipalities and Voronoi cells
55+
'ego_dp_substation_id_to_generator.sql', # Assign Substation ID (subst_id) to Generator (Conventional and Renewable)
56+
57+
## LOADAREA
58+
'ego_dp_loadarea_landuse.sql', # OSM landuse sectors
59+
'ego_dp_loadarea_industry_consumer.sql', # OSM Industry consumer
60+
'ego_dp_loadarea_loads.sql', # OSM Loads from landuse
61+
'ego_dp_loadarea_census.sql', # Loads from Census 2011
62+
'ego_dp_loadarea_loadmelt.sql', # Melt loads from OSM landuse and Census 2011
63+
'ego_dp_loadarea_loadcut_griddistrict.sql', # Cut Loadarea with MV Griddistrict
64+
'ego_dp_loadarea_loadcut_voronoi.sql', # Cut Loadarea with MV Voronoi cells
65+
'ego_dp_loadarea_consumption.sql', # Allocate consumption to Loadareas
66+
'ego_dp_loadarea_peakload.sql', # Peak loads per Loadarea
67+
'ego_dp_loadarea_griddistrict_results.sql', # Results for MV Griddistrict
68+
'ego_dp_loadarea_statistic.sql', # Results and statistics for eGoDP data
69+
70+
## LOWVOLTAGE
71+
'ego_dp_lv_substation.sql', # MVLV Substation (ONT)
72+
'ego_dp_lv_substation_voronoi.sql', # MVLV Substation Voronoi
73+
'ego_dp_lv_loadcut.sql', # LV Loadcut
74+
'ego_dp_lv_griddistrict.sql', # LV Griddistrict
75+
'ego_dp_lv_consumption_peakload.sql', # LV Consumption and Peakload
76+
77+
## REA
78+
'rea/ego_dp_lattice_500m.sql', # Lattice (point grid) 500m
79+
'rea/ego_dp_lattice_50m.sql', # Lattice (point grid) 50m
80+
'rea/ego_dp_rea_wpa_per_mvgd.sql', # Wind potential area (WPA)
81+
'rea/ego_dp_rea_lattice_per_area_500m.sql', # Prepare 500m lattice
82+
'rea/ego_dp_rea_lattice_per_area_50m.sql', # Prepare 50m lattice
83+
'rea/ego_dp_rea_setup.sql', # Setup tables for REA
84+
'rea/ego_dp_rea_m1.sql', # M1 biomass and solar to OSM agricultural
85+
'rea/ego_dp_rea_m2.sql', # M2 wind farms
86+
'rea/ego_dp_rea_m3.sql', # M3 wind turbines to WPA
87+
'rea/ego_dp_rea_m4.sql', # M4 other and rest
88+
'rea/ego_dp_rea_m5.sql', # M5 LV to Loadarea
89+
'rea/ego_dp_rea_results.sql', # Results and statistics
90+
91+
## POWERFLOW
92+
10093
'ego_dp_powerflow_hv_setup.sql', # Set schema/tables for EHV/HV powerflow calculations up
10194
'ego_dp_powerflow_osmtgmod_to_pypsa.sql', # Include data from osmTGmod into EHV/HV powerflow schema
10295
'ego_dp_powerflow_electrical_neighbour.sql', # Create border crossing lines and buses in neighbouring countries
103-
'ego_dp_powerflow_grid_future_scenarios.sql', # Copy grid to future scenarios
96+
'ego_dp_powerflow_fix_ehv_subnetworks.sql', # Fix topological errors in eHV grid
97+
'ego_dp_powerflow_grid_future_scenarios.sql', # Copy grid to future scenarios
98+
'ego_dp_powerflow_assignment_otgid.sql', # assign otg_id to pp lists
99+
'ego_dp_powerflow_assignment_unid.sql', # create a unified_id over all pp (res and conv)
100+
'ego_dp_powerflow_create_pp_mview.sql', # create mviews to display power plants per scenario
104101
'ego_dp_powerflow_assignment_generator.sql', # Assign generators to corresponding substation (SQ, NEP2035, eGo100)
105102
'ego_dp_powerflow_assignment_load.sql', # Assign loads to their corresponding substation (SQ, NEP2035, eGo100)
106103
'ego_dp_powerflow_assignment_storage.sql', # Assign storages to their corresponding substation (SQ, NEP 2035, eGo 100)
@@ -109,17 +106,22 @@ def data_processing():
109106
'ego_dp_powerflow_timeseries_demand.sql', # Insert demand series into corresponding powerflow table (SQ, NEP2035, eGo100)
110107
'ego_dp_powerflow_lopf_data.sql', # Set marginal costs for generators and storages
111108

109+
## POST-PROCESSING
110+
'ego_pp_nep2035_grid_variations.sql' # Create extension_tables and insert NEP-data
112111

113112
## VERSIONING
114113
'ego_dp_versioning.sql', # Versioning
115114
'ego_dp_versioning_mviews.sql' , # Versioning of mviews
115+
116+
117+
116118

117119
## VACUUM FULL
118120
# 'ego_dp_vacuum_full.sql'
119121
]
120122

121123
# get database connection
122-
conn = io.oedb_session(section='oedb')
124+
conn = io.oedb_session(section='ssh_ilka')
123125

124126
# iterate over list of sql- and python-snippets and execute them
125127
for snippet in snippets:

dataprocessing/python_scripts/ego_dp_loadarea_peakload.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def add_sectoral_peak_load(load_areas, **kwargs):
128128
columns=columns)
129129

130130
write_ego_scenario_log(conn=conn,
131-
version='v0.3.0',
131+
version='v0.4.0',
132132
io='input',
133133
schema='model_draft',
134134
table=table,
@@ -276,11 +276,11 @@ def add_sectoral_peak_load(load_areas, **kwargs):
276276
metadata.submit_comment(conn, json_str, schema, target_table)
277277

278278
write_ego_scenario_log(conn=conn,
279-
version='v0.3.0',
279+
version='v0.4.0',
280280
io='output',
281281
schema='model_draft',
282282
table=target_table,
283283
script='ego_dp_loadarea_peakload.py',
284284
entries=len(load_areas))
285285

286-
conn.close()
286+
conn.close()

dataprocessing/python_scripts/ego_dp_powerflow_griddistrict_demand.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
from datetime import time as settime
2222
from math import sqrt
2323
from dataprocessing.tools import io, metadata
24-
from dataprocessing.python_scripts.functions.ego_scenario_log import write_ego_scenario_log
24+
from dataprocessing.python_scripts.functions.ego_scenario_log import write_scenario_log
2525

2626

2727
def demand_per_mv_grid_district():
@@ -64,8 +64,9 @@ def demand_per_mv_grid_district():
6464
query_demand.statement, session.bind, index_col='otg_id').fillna(0)
6565
annual_demand_df = annual_demand_df.loc[~pd.isnull(annual_demand_df.index)]
6666

67-
write_ego_scenario_log(conn=conn,
68-
version='v0.3.0',
67+
write_scenario_log(conn=conn,
68+
version='v0.4.0',
69+
project='eGoDP',
6970
io='input',
7071
schema='model_draft',
7172
table=orm_loads.__tablename__,
@@ -78,8 +79,9 @@ def demand_per_mv_grid_district():
7879
schema,
7980
index_col='polygon_id')
8081

81-
write_ego_scenario_log(conn=conn,
82-
version='v0.3.0',
82+
write_scenario_log(conn=conn,
83+
version='v0.4.0',
84+
project='eGoDP',
8385
io='input',
8486
schema='model_draft',
8587
table='ego_demand_hv_largescaleconsumer',
@@ -185,8 +187,9 @@ def demand_per_mv_grid_district():
185187

186188
metadata.submit_comment(conn, json_str, schema, target_table)
187189

188-
write_ego_scenario_log(conn=conn,
189-
version='v0.3.0',
190+
write_scenario_log(conn=conn,
191+
version='v0.4.0',
192+
project='eGoDP',
190193
io='output',
191194
schema=schema,
192195
table=target_table,

dataprocessing/python_scripts/functions/ego_scenario_log.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,19 @@
1010

1111
from datetime import datetime
1212
from sqlalchemy.orm import sessionmaker
13-
from egoio.db_tables.model_draft import EgoScenarioLog as orm_scenario_log
13+
from egoio.db_tables.model_draft import ScenarioLog as orm_scenario_log
1414

1515

16-
def write_ego_scenario_log(conn, version, io, schema, table,
16+
def write_scenario_log(conn, project, version, io, schema, table,
1717
script, entries=None, comment=None, metadata=None):
1818
"""
1919
Write entry into scenario log table
2020
2121
Parameters
2222
----------
2323
conn: SQLAlchemy connection object
24+
project: str
25+
Project name
2426
version: str
2527
Version number
2628
io: str
@@ -40,7 +42,8 @@ def write_ego_scenario_log(conn, version, io, schema, table,
4042
4143
Example
4244
-------
43-
write_ego_scenario_log(conn=conn,
45+
write_scenario_log(conn=conn,
46+
project='eGoDP'
4447
version='v0.3.0',
4548
io='output',
4649
schema='model_draft',
@@ -64,13 +67,14 @@ def write_ego_scenario_log(conn, version, io, schema, table,
6467
user = 'unknown'
6568

6669
# Add data to orm object
67-
log_entry = orm_scenario_log(version=version,
70+
log_entry = orm_scenario_log(project=project,
71+
version=version,
6872
io=io,
6973
schema_name=schema,
7074
table_name=table,
7175
script_name=script,
7276
entries=entries,
73-
status=comment,
77+
comment=comment,
7478
user_name=user,
7579
timestamp=datetime.now(),
7680
meta_data=metadata)

dataprocessing/python_scripts/setup_ego_mv_powerflow.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def create_powerflow_schema(engine, schema, tables):
6868
tools.grant_db_access(conn, schema, table, group)
6969

7070
write_ego_scenario_log(conn=conn,
71-
version='v0.3.0',
71+
version='v0.4.0',
7272
io='output',
7373
schema=schema,
7474
table=table,

0 commit comments

Comments
 (0)