Skip to content

Commit

Permalink
additional atlite example
Browse files Browse the repository at this point in the history
  • Loading branch information
fneum committed Nov 20, 2023
1 parent d8ed70b commit b75d44d
Show file tree
Hide file tree
Showing 4 changed files with 2,724 additions and 203 deletions.
2,845 changes: 2,705 additions & 140 deletions data-science-for-esm/06-workshop-atlite.ipynb

Large diffs are not rendered by default.

78 changes: 17 additions & 61 deletions data-science-for-esm/07-workshop-networkx.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,15 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Say we want to calculate the Laplacian $L$ of this graph based on its incidence matrix $K$. We first need to write down the incidence matrix $K$ as a `np.array`. Let's also use the convention that edges are oriented such that they are directed at the node with the higher label value (i.e. from node 1 to node 2, not vice versa)."
"Say we want to calculate the Laplacian $L$ of this graph based on its incidence\n",
"matrix $K$, which is an $N\\times N$ matrix defined as $L=KK^\\top$ for an\n",
"undirected graph. The Laplacian matrix of a graph is a representation that\n",
"captures the connectivity and structure of the graph by quantifying the\n",
"difference between the degree of each vertex and the adjacency relationships\n",
"with its neighbouring vertices. We first need to write down the incidence matrix\n",
"$K$ as a `np.array`. Let's also use the convention that edges are oriented such\n",
"that they are directed at the node with the higher label value (i.e. from node 1\n",
"to node 2, not vice versa)."
]
},
{
Expand Down Expand Up @@ -994,7 +1002,12 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Let's checkout the synchronous zone of Ireland. We want to compute the **Power Transfer Distribution Factor (PTDF)** matrix for this area."
"Let's checkout the synchronous zone of Ireland. We want to compute the **Power Transfer Distribution Factor (PTDF)** matrix for this area.\n",
"\n",
"The **PTDF** matrix measures the sensitivity of power flows in each transmission line relative to incremental changes in nodal power injections or withdrawals throughout the electricity network. It is a matrix representation showing how changes in power injections or withdrawals at various nodes in a power grid affect the flow in each of its transmission lines. It is an alternative formulation for linearised power flow to the cycle-based approache from the lecture.\n",
"\n",
"$$f_\\ell = \\frac{1}{x_\\ell}\\sum_{i,j} K_{i\\ell} (L^{-1})_{ij} p_j$$\n",
"$$f_\\ell = \\sum_j \\text{PTDF}_{\\ell j} p_j$$"
]
},
{
Expand Down Expand Up @@ -1062,7 +1075,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"If we want to calculate the weighted Laplacian $L = KBK^\\top$, we also need the diagonal matrix $B$ for the susceptances (i.e inverse of reactances):"
"If we want to calculate the weighted Laplacian $L = KBK^\\top$, we also need the diagonal matrix $B$ for the susceptances (i.e inverse of reactances; $1/x_\\ell$):"
]
},
{
Expand Down Expand Up @@ -1126,24 +1139,6 @@
"L = K.dot(H)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"L.min()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"L.max()"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down Expand Up @@ -1189,24 +1184,6 @@
"L_inv = np.vstack((np.zeros(n_nodes), L_inv))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"L_inv.min()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"L_inv.max()"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand All @@ -1220,10 +1197,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Now, we have all the ingredients to calculate the PTDF matrix\n",
"\n",
"$$f_\\ell = \\frac{1}{x_\\ell}\\sum_{i,j} K_{i\\ell} (L^{-1})_{ij} p_j$$\n",
"$$f_\\ell = \\sum_j \\text{PTDF}_{\\ell j} p_j$$"
"Now, we have all the ingredients to calculate the PTDF matrix"
]
},
{
Expand All @@ -1235,24 +1209,6 @@
"PTDF = H.dot(L_inv)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"PTDF.min()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"PTDF.max()"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down
2 changes: 1 addition & 1 deletion data-science-for-esm/_toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ chapters:
- file: 02-workshop-numpy
- file: 03-workshop-pandas
- file: 04-workshop-geopandas
- file: 05-workshop-pysheds
- file: 06-workshop-atlite
- file: 05-workshop-pysheds
- file: 07-workshop-networkx
- file: 08-workshop-pyomo
- file: 09-workshop-pypsa
Expand Down
2 changes: 1 addition & 1 deletion data-science-for-esm/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Welcome to the website accompanying the course [Data Science for Energy System M

On this website you will find practical introductions to many Python packages that are useful for dealing with energy data and building energy system models. Course materials other than practical introductions to Python packages for students at TU Berlin are provided on [ISIS](https://isis.tu-berlin.de/course/view.php?id=35495).

The course covers tutorials and examples for getting started with Python, `numpy`, `matplotlib`, `pandas`, `geopandas`, `cartopy`, `rasterio`, `atlite`, `networkx`, `pyomo`, `pypsa`, `plotly`, `hvplot`, and `streamlit`. Topics covered include:
The course covers tutorials and examples for getting started with Python, `numpy`, `matplotlib`, `pandas`, `geopandas`, `cartopy`, `rasterio`, `pysheds`, `atlite`, `networkx`, `pyomo`, `pypsa`, `plotly`, `hvplot`, and `streamlit`. Topics covered include:

- time series analysis (e.g. wind and solar production)
- tabular data (e.g. LNG terminals, power plants, industrial sites)
Expand Down

0 comments on commit b75d44d

Please sign in to comment.