Skip to content

Commit

Permalink
address
Browse files Browse the repository at this point in the history
deprecation warnings
  • Loading branch information
fneum committed Apr 15, 2024
1 parent 6166a3d commit 11c67b9
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 24 deletions.
2 changes: 1 addition & 1 deletion data-science-for-esm/02-workshop-numpy.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"Documentation for this package is available at https://numpy.org/doc/stable/index.html.\n",
":::\n",
"\n",
"<img src=\"https://matplotlib.org/_static/logo2_compressed.svg\" width=\"300px\" />\n",
"<img src=\"https://matplotlib.org/stable/_images/sphx_glr_logos2_003_2_00x.png\" width=\"300px\" />\n",
"\n",
"**Matplotlib**: _Matplotlib is a comprehensive library for creating static and animated visualizations in Python._\n",
"\n",
Expand Down
4 changes: 2 additions & 2 deletions data-science-for-esm/06-workshop-atlite.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@
"outputs": [],
"source": [
"shape = countries.to_crs(excluder.crs).loc[[\"PT\"]].geometry\n",
"shape[0]"
"shape.iloc[0]"
]
},
{
Expand Down Expand Up @@ -691,7 +691,7 @@
"metadata": {},
"outputs": [],
"source": [
"country_area = shape.geometry.area[0]"
"country_area = shape.geometry.area.iloc[0]"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion data-science-for-esm/09-workshop-pypsa.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1309,7 +1309,7 @@
"metadata": {},
"outputs": [],
"source": [
"n.generators_t.p_max_pu.groupby(n.generators.carrier, axis=1).mean().plot(ylabel=\"p.u.\")"
"n.generators_t.p_max_pu.T.groupby(n.generators.carrier).mean().T.plot(ylabel=\"p.u.\")"
]
},
{
Expand Down
6 changes: 2 additions & 4 deletions data-science-for-esm/10-workshop-pypsa-cem.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@
"outputs": [],
"source": [
"resolution = 4\n",
"ts = ts.resample(f\"{resolution}H\").first()"
"ts = ts.resample(f\"{resolution}h\").first()"
]
},
{
Expand Down Expand Up @@ -719,9 +719,7 @@
" p_by_carrier = n.generators_t.p.groupby(n.generators.carrier, axis=1).sum().div(1e3)\n",
"\n",
" if not n.storage_units.empty:\n",
" sto = (\n",
" n.storage_units_t.p.groupby(n.storage_units.carrier, axis=1).sum().div(1e3)\n",
" )\n",
" sto = n.storage_units_t.p.T.groupby(n.storage_units.carrier).sum().T.div(1e3)\n",
" p_by_carrier = pd.concat([p_by_carrier, sto], axis=1)\n",
"\n",
" fig, ax = plt.subplots(figsize=(6, 3))\n",
Expand Down
26 changes: 10 additions & 16 deletions data-science-for-esm/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Welcome to the website accompanying the course [Data Science for Energy System Modelling](https://moseskonto.tu-berlin.de/moses/modultransfersystem/bolognamodule/beschreibung/anzeigen.html;jsessionid=DQfixqzzpn1XIg5N1GG7S9um4EDykZn99AHmH6Fj.moseskonto?number=31027&version=1&sprache=2). This course is being developed by [Dr. Fabian Neumann](https://neumann.fyi) and offered as part of the curriculum of the [Department of Digital Transformation of Energy Systems at TU Berlin](https://www.tu.berlin/ensys).

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).
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=38042).

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

Expand All @@ -19,21 +19,15 @@ The course covers tutorials and examples for getting started with Python, `numpy
- sector-coupling
- interactive visualisation and dashboarding

## Python

:::{note}
This section is adapted from another course called [Earth and Environmental Data Science: Python Environments](https://earth-env-data-science.github.io/lectures/environment/python_environments.html)
:::
## Installing the package manager `conda`

Python and nearly all of the software packages in the scientific python
ecosystem are [open-source](https://opensource.org/). Coordinating the
compatibility between these different packages and their multiple versions used
to be a nightmare! Fortunately, the problem is solved by using a Python
_distribution_ and/or _package manager_. You should use a package manager!

## Installing the package manager `conda`

### Anaconda Python distribution
### Anaconda

The easiest way to set up a full-stack scientific Python deployment is to use a
Python distribution. This is an installation of Python with a set of curated
Expand All @@ -49,14 +43,14 @@ For **Windows users**, you should first install Anaconda (described above) or mi

From the Anaconda Prompt, you should be able to run `conda` and other shell commands.

### Lightweight alternative: `miniconda`
### Lightweight `miniconda`

If you don't want to download a large file like the Anaconda Python Distribution (ca. 800 MB), there is a
lightweight alternative installation called `miniconda`.

- [Miniconda Installation](https://docs.conda.io/en/latest/miniconda.html)

### Using Python without a local installation
### Google Colab

You can even start the course without a local Python installation using online services like [Google Colab (colab.google)](https://colab.google) which provide an online Python version
in a [Jupyter Notebook](jupyter.org/) environment.
Expand Down Expand Up @@ -116,9 +110,9 @@ configuration can be installed by executing
For extensive documentation on using environments, please see
[the conda documentation](https://conda.io/docs/using/envs.html).

## Python environment for this course: `esm-2024`
## Environment for this course: `esm-2024`

## With `conda`
### ... with `conda`

The latest environment specification for this course can be downloaded under the following link as a [`YAML`-file](https://en.wikipedia.org/wiki/YAML):

Expand All @@ -142,7 +136,7 @@ The environment has to be activated whenever you open a new terminal,

jupyter lab

### With `pip`
### ... with `pip`

If you want to use `pip` for managing your environment, download

Expand All @@ -159,7 +153,7 @@ This should allow you to start a new Jupyter window:

jupyter lab

## JupyterLab and Jupyter Notebooks
## JupyterLab

[JupyterLab](https://jupyterlab.readthedocs.io) will be our primary method for
interacting with the computer. JupyterLab contains a complete environment for
Expand All @@ -175,7 +169,7 @@ here, we point you to their docs. The following pages are particularly relevant:
- [Terminals](https://jupyterlab.readthedocs.io/en/stable/user/terminal.html)
- [Managing Kernels and Terminals](https://jupyterlab.readthedocs.io/en/stable/user/running.html)

## Markdown Syntax
## Markdown

Throughout the course, you might want to write rich text documents using Markdown.
This is also very common in Jupyter Notebooks.
Expand Down
3 changes: 3 additions & 0 deletions environment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ dependencies:
- powerplantmatching>=0.5.12
- rasterio>=1.3.2
- pysheds
- pyarrow
- numba

# interactive python
- ipython
Expand Down Expand Up @@ -50,6 +52,7 @@ dependencies:
# publishing
- jupyter-book
- ghp-import
- pre-commit

- pip:
- highspy
3 changes: 3 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,6 @@ highspy>=1.5.3
folium
mapclassify
numexpr<2.8.5 # until https://github.com/pandas-dev/pandas/issues/54449 resolved
pyarrow
numba
pre-commit

0 comments on commit 11c67b9

Please sign in to comment.