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

Documentation/rli datasets #1138

Merged
merged 79 commits into from
Aug 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
b89177c
Document VG250 dataset
birgits Jul 19, 2023
72594b6
Document dataset Vg250MvGridDistricts
birgits Jul 19, 2023
786e09f
Document dataset ZensusMvGridDistricts
birgits Jul 19, 2023
b39d8da
Document dataset MvGridDistricts
birgits Jul 19, 2023
3aecc2e
document dataset CtsDemandBuildings
JonasJeckstadt Jul 24, 2023
043a3af
fix error in previous commit.
JonasJeckstadt Jul 24, 2023
9034ab5
Minor changes CtsDemandBuildings dataset documentation
birgits Jul 25, 2023
8d92e19
Document dataset Household Demands
JonasJeckstadt Jul 27, 2023
8bb6d3c
Add dataset documentation for HeavyDutyTransport dataset
birgits Jul 28, 2023
616c1b0
Adapt rst files to include docstrings of emobility modules
birgits Jul 28, 2023
e6e9cf9
Add dataset documentation
ClaraBuettner Jul 19, 2023
0adaa2d
Add dataset documentation for district heating areas
ClaraBuettner Jul 19, 2023
fd9c20c
Add dataset documentation for HeatDemandImport
ClaraBuettner Jul 19, 2023
17cf1e0
Add dataset documentation for CHP
ClaraBuettner Jul 19, 2023
661f35d
Add dataset documentation for heat supply
ClaraBuettner Jul 19, 2023
29fea37
Add dataset documentation for eTraGo heat
ClaraBuettner Jul 19, 2023
91ee41a
Add documentation of ChpEtrago dataset
ClaraBuettner Jul 19, 2023
c10c668
Add dataset documentation for hts etrago
ClaraBuettner Jul 19, 2023
d936f78
Black
ClaraBuettner Jul 19, 2023
a49218d
Add dataset documentation
ClaraBuettner Jul 19, 2023
75a783a
Refer to called function when dataset was defined with partial
ClaraBuettner Jul 20, 2023
c7617f4
Remove unused lines
ClaraBuettner Jul 20, 2023
1971b38
Fix typo in link to Vg250 dataset
ClaraBuettner Jul 20, 2023
dc3da12
Link to database setup function
ClaraBuettner Jul 20, 2023
d1af462
Split long line strings
ClaraBuettner Jul 20, 2023
b4299f1
Minor fixes
birgits Jul 28, 2023
9bba524
Add dataset documentation for Era5
ClaraBuettner Jul 20, 2023
6874073
Apply black
ClaraBuettner Jul 20, 2023
a60f450
Correct description of era5 dataset
ClaraBuettner Jul 20, 2023
5de2d89
Add dataset documentation for renewable feedin
ClaraBuettner Jul 20, 2023
adac700
Apply black
ClaraBuettner Jul 20, 2023
ab3ea87
Add dataset description for TYNDP
ClaraBuettner Jul 20, 2023
c08cba9
Apply black
ClaraBuettner Jul 20, 2023
e6298d0
Add dataset documentation for electrical neighbours
ClaraBuettner Jul 20, 2023
f47c33d
Apply black
ClaraBuettner Jul 20, 2023
e0c566c
Add dataset documentation for scenario parameters
ClaraBuettner Jul 20, 2023
b2d9eab
Apply black
ClaraBuettner Jul 20, 2023
cc9143b
Add dataset documentation for scenario capacities
ClaraBuettner Jul 20, 2023
522f416
Apply black
ClaraBuettner Jul 20, 2023
108698f
Fix typo
ClaraBuettner Jul 20, 2023
2bd723b
Add dataset documentation for FixEhvSubnetworks
ClaraBuettner Jul 20, 2023
7c752d7
Apply black
ClaraBuettner Jul 20, 2023
d7526fe
Extend list of resulting tables
ClaraBuettner Jul 20, 2023
e0cdd60
Fix name of Tyndp dataset
ClaraBuettner Jul 20, 2023
f40f5b1
Fix links to dependencies
ClaraBuettner Jul 20, 2023
5b74ce0
Fix typo
ClaraBuettner Jul 20, 2023
96ba824
Fix links to dependencies
ClaraBuettner Jul 20, 2023
f685cff
Fix link to database.setup
ClaraBuettner Jul 20, 2023
521c661
Fixes and changes in HouseholdDemands dataset documentation
birgits Aug 3, 2023
35f88eb
Document dataset LoadArea
JonasJeckstadt Aug 7, 2023
b736cef
fix accidentally deleted task define_mv_grid_districts
JonasJeckstadt Aug 7, 2023
9b9c3b4
Document dataset MITChargingInfrastructure with open todo
JonasJeckstadt Aug 7, 2023
14f0a58
Fixes and changes in LoadArea and MITChargingInfrastructure datasets
birgits Aug 8, 2023
6c87ee9
Wrap docstring lines at 72ish characters
gnn Aug 9, 2023
a1423b9
Shorten commented line to be below 79 characters
gnn Aug 9, 2023
3aae1d4
Shorten line to below 79 characters
gnn Aug 9, 2023
e0a702b
Reformat with `black`
gnn Aug 9, 2023
4562882
Add a `Tasks` type alias to the `datasets` module
gnn Aug 9, 2023
ecf2a63
Replace `partial`s of `Dataset` with subclasses
gnn Aug 9, 2023
ddadce1
Merge pull request #1145 from openego/documentation/rli-datasets/repl…
birgits Aug 10, 2023
5d27af3
Change references to partial datasets
birgits Aug 10, 2023
405695b
Document dataset Demand_Building_Assignment
JonasJeckstadt Aug 10, 2023
dc144f3
Document dataset MatrData
JonasJeckstadt Aug 10, 2023
5bda166
Document dataset MotorizedIndividualTravel with open Todos
JonasJeckstadt Aug 10, 2023
6198a1a
Tell Sphinx not to expand some type aliases
gnn Aug 11, 2023
64af889
Uppercase SQL built-ins in SQL code block
gnn Aug 11, 2023
c570601
Add an article to a documentation sentence
gnn Aug 11, 2023
f03282a
Make SQL code block in documentation more compact
gnn Aug 11, 2023
046ce40
Wrap docstrings at 76 characters
gnn Aug 11, 2023
cae7e59
Add some blank lines
gnn Aug 11, 2023
4ea3809
Manually specify `Dataset` subclass constructors
gnn Aug 11, 2023
af31b60
Add documentation for remaining datasets
birgits Aug 11, 2023
32b93b5
Merge branch 'documentation/rli_datasets' into documentation/rli-data…
birgits Aug 11, 2023
e10ab8b
Merge branch for alternative replacement for datasets previously crea…
birgits Aug 11, 2023
ad87ecf
Merge branch 'dev' into documentation/rli_datasets
birgits Aug 11, 2023
7272c90
Get rid of duplicated documentation and cross-reference data and data…
birgits Aug 11, 2023
578054d
PEP changes
birgits Aug 31, 2023
919c0e4
Add references
birgits Aug 31, 2023
4047b97
Minor changes to mobility docstrings
birgits Aug 31, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,8 @@

add_module_names = False
modindex_common_prefix = ["egon.data.", "egon.data.datasets."]

autodoc_type_aliases = {
"Dependencies": "egon.data.datasets.Dependencies",
"Tasks": "egon.data.datasets.Tasks"
}
22 changes: 12 additions & 10 deletions docs/data.rst
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
****
Data
****
The description of the methods, input data and results of the eGon-data pipeline is given in the following section.
The description of the methods, input data and results of the eGon-data pipeline is given in the following section.
References to datasets and functions are integrated if more detailed information is required.

Main input data and their processing
====================================

All methods in the eGon-data workflow rely on public and freely available data from different external sources. The most important data sources
and their processing within the eGon-data pipeline are described here.
and their processing within the eGon-data pipeline are described here.

.. include:: data/input_data.rst

Grid models
===========

Power grid models of different voltage levels form a central part of the eGon data model, which is required for cross-grid-level optimization.
In addition, sector coupling necessitates the representation of the gas grid infrastructure, which is also described in this section.
In addition, sector coupling necessitates the representation of the gas grid infrastructure, which is also described in this section.

Electricity grid
----------------
Expand All @@ -31,8 +31,8 @@ Gas grid
Demand
======

Electricity, heat and gas demands from different consumption sectors are taken into account in eGon-data. The related methods to distribute and
process the demand data are described in the following chapters for the different consumption sectors separately.
Electricity, heat and gas demands from different consumption sectors are taken into account in eGon-data. The related methods to distribute and
process the demand data are described in the following chapters for the different consumption sectors separately.

.. _electricity-demand-ref:

Expand All @@ -51,6 +51,8 @@ Gas

.. include:: data/gas_demand.rst

.. _mobility-demand-ref:

Mobility
--------

Expand All @@ -60,8 +62,8 @@ Mobility
Supply
======

The distribution and assignment of supply capacities or potentials are carried out technology-specific. The different methods are described in the
following chapters.
The distribution and assignment of supply capacities or potentials are carried out technology-specific. The different methods are described in the
following chapters.

Electricity
-----------
Expand All @@ -81,9 +83,9 @@ Gas
Flexibility options
===================

Different flexibility options are part of the model and can be utilized in the optimization of the energy system. Therefore detailed information about
flexibility potentials and their distribution are needed. The considered technologies described in the following chapters range from different storage units,
through dynamic line rating to Demand-Side-Management measures.
Different flexibility options are part of the model and can be utilized in the optimization of the energy system. Therefore detailed information about
flexibility potentials and their distribution are needed. The considered technologies described in the following chapters range from different storage units,
through dynamic line rating to Demand-Side-Management measures.

Demand-Side-Management
----------------------
Expand Down
2 changes: 2 additions & 0 deletions docs/data/electricity_supply.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ Offshore wind
PV ground mounted
++++++++++++++++++

.. _pv-rooftop-ref:

PV rooftop
+++++++++++

Expand Down
2 changes: 2 additions & 0 deletions docs/data/mobility_demand.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.. _mobility-demand-mit-ref:

Motorized individual travel
++++++++++++++++++++++++++++

Expand Down
11 changes: 10 additions & 1 deletion docs/reference/egon.data.datasets.emobility.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,14 @@

emobility
=========
.. toctree::
:maxdepth: 1

.. py:module:: egon.data.datasets.emobility
egon.data.datasets.emobility.heavy_duty_transport
egon.data.datasets.emobility.motorized_individual_travel
egon.data.datasets.emobility.motorized_individual_travel_charging_infrastructure

.. automodule:: egon.data.datasets.emobility
:members:
:undoc-members:
:show-inheritance:
1 change: 1 addition & 0 deletions docs/reference/egon.data.datasets.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ datasets
egon.data.datasets.district_heating_areas
egon.data.datasets.electricity_demand
egon.data.datasets.electricity_demand_timeseries
egon.data.datasets.emobility
egon.data.datasets.gas_neighbours
egon.data.datasets.heat_demand
egon.data.datasets.heat_demand_timeseries
Expand Down
4 changes: 2 additions & 2 deletions src/egon/data/airflow/dags/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@
]
)

# Get household electrical demands for cencus cells
# Get household electrical demands for census cells
household_electricity_demand_annual = HouseholdElectricityDemand(
dependencies=[
tasks[
Expand All @@ -285,7 +285,7 @@
]
)

# Distribute electrical CTS demands to zensus grid
# Distribute electrical CTS demands to census grid
cts_electricity_demand_annual = CtsElectricityDemand(
dependencies=[
demandregio,
Expand Down
32 changes: 20 additions & 12 deletions src/egon/data/datasets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ class Model(Base):
#: a :class:`tuple` of :class:`TaskGraphs <TaskGraph>` will be executed
#: sequentially in the given order.
TaskGraph = Union[Task, Set["TaskGraph"], Tuple["TaskGraph", ...]]
#: A type alias to help specifying that something can be an explicit
#: :class:`Tasks_` object or a :class:`TaskGraph`, i.e. something that
#: can be converted to :class:`Tasks_`.
Tasks = Union["Tasks_", TaskGraph]


def prefix(o):
Expand All @@ -107,15 +111,15 @@ def prefix(o):


@dataclass
class Tasks(dict):
class Tasks_(dict):
first: Set[Task]
last: Set[Task]
graph: TaskGraph = ()

def __init__(self, graph: TaskGraph):
"""Connect multiple tasks into a potentially complex graph.

Parses a :class:`TaskGraph` into a :class:`Tasks` object.
Parses a :class:`TaskGraph` into a :class:`Tasks_` object.
"""
if isinstance(graph, Callable):
graph = PythonOperator(
Expand All @@ -131,14 +135,14 @@ def __init__(self, graph: TaskGraph):
self.first = {}
self.last = {}
elif isinstance(graph, abc.Set):
results = [Tasks(subtasks) for subtasks in graph]
results = [Tasks_(subtasks) for subtasks in graph]
self.first = {task for result in results for task in result.first}
self.last = {task for result in results for task in result.last}
self.update(reduce(lambda d1, d2: dict(d1, **d2), results, {}))
self.graph = set(tasks.graph for tasks in results)
elif isinstance(graph, tuple):
results = [Tasks(subtasks) for subtasks in graph]
for (left, right) in zip(results[:-1], results[1:]):
results = [Tasks_(subtasks) for subtasks in graph]
for left, right in zip(results[:-1], results[1:]):
for last in left.last:
for first in right.first:
last.set_downstream(first)
Expand All @@ -149,13 +153,17 @@ def __init__(self, graph: TaskGraph):
else:
raise (
TypeError(
"`egon.data.datasets.Tasks` got an argument of type:\n\n"
"`egon.data.datasets.Tasks_` got an argument of type:\n\n"
f" {type(graph)}\n\n"
"where only `Task`s, `Set`s and `Tuple`s are allowed."
)
)


#: A dataset can depend on other datasets or the tasks of other datasets.
Dependencies = Iterable[Union["Dataset", Task]]


@dataclass
class Dataset:
#: The name of the Dataset
Expand All @@ -172,10 +180,10 @@ class Dataset:
#: downstream of any of the listed dependencies. In case of bare
#: :class:`Task`, a direct link will be created whereas for a
#: :class:`Dataset` the link will be made to all of its last tasks.
dependencies: Iterable[Union[Dataset, Task]] = ()
dependencies: Dependencies = ()
#: The tasks of this :class:`Dataset`. A :class:`TaskGraph` will
#: automatically be converted to :class:`Tasks`.
tasks: Union[Tasks, TaskGraph] = ()
#: automatically be converted to :class:`Tasks_`.
tasks: Tasks = ()

def check_version(self, after_execution=()):
def skip_task(task, *xs, **ks):
Expand Down Expand Up @@ -224,8 +232,8 @@ def update(self, session):

def __post_init__(self):
self.dependencies = list(self.dependencies)
if not isinstance(self.tasks, Tasks):
self.tasks = Tasks(self.tasks)
if not isinstance(self.tasks, Tasks_):
self.tasks = Tasks_(self.tasks)
if len(self.tasks.last) > 1:
# Explicitly create single final task, because we can't know
# which of the multiple tasks finishes last.
Expand All @@ -236,7 +244,7 @@ def __post_init__(self):
# Do nothing, because updating will be added later.
python_callable=lambda *xs, **ks: None,
)
self.tasks = Tasks((self.tasks.graph, update_version))
self.tasks = Tasks_((self.tasks.graph, update_version))
# Due to the `if`-block above, there'll now always be exactly
# one task in `self.tasks.last` which the next line just
# selects.
Expand Down