README.md 4.49 KB
Newer Older
Fabian Neumann's avatar
Fabian Neumann committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# Tutorial Structure

## Worksheets and Material

The tutorials include both, coding exercises and calculations done by hand.

There's a worksheet (`sheet-0X.pdf`) for every tutorial in `tutorial-X/worksheet`.

If the tutorial includes coding exercises (some tutorials have no coding exercises),
there are `jupyter notebooks` (`tutorial-X-task-Y.ipynb`) and data sources provided in `tutorial-X/notebooks`.

## Solutions

Solutions for coding exercises and calculations by hand are also included in the repository.

* See `tutorial-X/notebooks/tutorial-X-task-Y-solution.ipynb` for solutions to coding exercises.

* See `tutorial-X/worksheet/solution-0X.pdf` for solutions to calculations done by hand.

You may refer to them at any time, but (needless to say) it is best if you try without first.

22
# Python Tutorials
fabian.neumann's avatar
fabian.neumann committed
23

24
In the tutorials we will repeatedly work with the programming language Python. If you are unfamiliar with the language, you might find the following tutorials useful.
fabian.neumann's avatar
fabian.neumann committed
25

26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
The [Python notebook based notes of Robert Johansson](http://nbviewer.jupyter.org/github/jrjohansson/scientific-python-lectures/tree/master/) are a
comprehensive kick starter.
 * [Lecture 0](http://nbviewer.jupyter.org/github/jrjohansson/scientific-python-lectures/blob/master/Lecture-0-Scientific-Computing-with-Python.ipynb) covers installation and getting ready.
 * [Lecture 1](http://nbviewer.jupyter.org/github/jrjohansson/scientific-python-lectures/blob/master/Lecture-1-Introduction-to-Python-Programming.ipynb)
       zooms through most basic general python control structures (only
       brush over it and stop reading early, i.e. if you read the word
       `classes` you already know too much).
 * [Lecture 2](http://nbviewer.jupyter.org/github/jrjohansson/scientific-python-lectures/blob/master/Lecture-2-Numpy.ipynb) is the most important and closely connected to the exercises.
* You might as well stop now, but if you are hooked, have a look at [Lecture 3](http://nbviewer.jupyter.org/github/jrjohansson/scientific-python-lectures/blob/master/Lecture-3-Scipy.ipynb) for more physics and [Lecture 4](http://nbviewer.jupyter.org/github/jrjohansson/scientific-python-lectures/blob/master/Lecture-4-Matplotlib.ipynb) for prettier graphs.

Further reference material of help is are the website-books http://python-course.eu/ (English), http://python-kurs.eu/ (German); especially of interest might be the [pandas](http://www.python-course.eu/pandas.php) bit in the end, which will make the exercises a breeze at the expense of yet another package to learn.

# Downloading Tutorial Material

You can download the tutorials with `git` with the following command:

```bash
cd /path/where/your/tutorial/folder/should/be
fabian.neumann's avatar
fabian.neumann committed
44
45
git clone https://git.scc.kit.edu/sp2668/esm_tutorials.git
```
fabian.neumann's avatar
fabian.neumann committed
46
or
47
48
```bash
cd /path/where/your/tutorial/folder/should/be
fabian.neumann's avatar
fabian.neumann committed
49
50
git clone git@git.scc.kit.edu:sp2668/esm_tutorials.git
```
51
if you have `ssh` setup at `git.scc.kit.edu`.
fabian.neumann's avatar
fabian.neumann committed
52

53
Alternatively, (not as nice as description above) you can download the tutorials as compressed zip-file from
54
https://git.scc.kit.edu/sp2668/esm_tutorials/-/archive/master/esm_tutorials-master.zip
fabian.neumann's avatar
fabian.neumann committed
55

sp2668's avatar
sp2668 committed
56
57
# Installation Guide

58
59
60
61
**If you happen to come across this before the tutorials start,
you may already want to follow the installation instructions already to get started right away.**

We recommend using the package manager and environment management system `conda` to install the packages we need.
62

63
64
Install [`miniconda`](https://conda.io/docs/user-guide/install/index.html) (or Anaconda). For instructions for your operating system
see https://conda.io/docs/user-guide/install/index.html. 
sp2668's avatar
sp2668 committed
65

66
Create a new `conda` environment from the provided `environment.yaml` file with the following set of commands:
sp2668's avatar
sp2668 committed
67
68

Windows:
69
```bash
Fabian Neumann's avatar
Fabian Neumann committed
70
conda env create -f environment.yaml
sp2668's avatar
sp2668 committed
71
72
73
activate esm-tutorials
```

fabian.neumann's avatar
fabian.neumann committed
74
macOS and Linux:
75
```bash
Fabian Neumann's avatar
Fabian Neumann committed
76
conda env create -f environment.yaml
77
78
79
80
81
82
conda activate esm-tutorials
```

On some older Linux installations the last command can be instead

```bash
sp2668's avatar
sp2668 committed
83
84
85
source activate esm-tutorials
```

86
87
88
89
90
91
92
93
94
95
For detailed instructions see
https://conda.io/docs/user-guide/tasks/manage-environments.html#creating-an-environment-from-an-environment-yml-file.
It will take some time!

With the `conda` environment installed and activated, open a jupyter notebook/lab with the following command in the tutorial folder (where your notebooks are):

```bash
cd /path/where/your/tutorial/folder/should/be
cd esm-tutorials
jupyter lab
sp2668's avatar
sp2668 committed
96
```
97
98
99
100
101
102

or

```bash
cd /path/where/your/tutorial/folder/should/be
cd esm-tutorials
sp2668's avatar
sp2668 committed
103
104
105
jupyter notebook
```

Fabian Neumann's avatar
Fabian Neumann committed
106
You should now be ready to do the tutorials :)