SETUP.md 3.93 KB
Newer Older
1
# Python Tutorials
fabian.neumann's avatar
fabian.neumann committed
2

3
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
4

5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
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
23 24
git clone https://git.scc.kit.edu/sp2668/esm_tutorials.git
```
fabian.neumann's avatar
fabian.neumann committed
25
or
26 27
```bash
cd /path/where/your/tutorial/folder/should/be
fabian.neumann's avatar
fabian.neumann committed
28 29
git clone git@git.scc.kit.edu:sp2668/esm_tutorials.git
```
30
if you have `ssh` setup at `git.scc.kit.edu`.
fabian.neumann's avatar
fabian.neumann committed
31

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

sp2668's avatar
sp2668 committed
35 36
# Installation Guide

37 38 39 40
**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'll be using `Python` in the tutorials. If you are unfamiliar with `Python`, [this](http://introtopython.org/) is a great start, but a quick Google search on `Python` tutorials will give you millions of great alternatives.
sp2668's avatar
sp2668 committed
41

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

44 45
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
46

47
Create a new `conda` environment from the provided `environment.yaml` file with the following set of commands:
sp2668's avatar
sp2668 committed
48 49

Windows:
50
```bash
sp2668's avatar
sp2668 committed
51 52 53 54
conda env create -f requirements.yml
activate esm-tutorials
```

fabian.neumann's avatar
fabian.neumann committed
55
macOS and Linux:
56
```bash
sp2668's avatar
sp2668 committed
57
conda env create -f requirements.yml
58 59 60 61 62 63
conda activate esm-tutorials
```

On some older Linux installations the last command can be instead

```bash
sp2668's avatar
sp2668 committed
64 65 66
source activate esm-tutorials
```

67 68 69 70 71 72 73 74 75 76
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
77
```
78 79 80 81 82 83

or

```bash
cd /path/where/your/tutorial/folder/should/be
cd esm-tutorials
sp2668's avatar
sp2668 committed
84 85 86 87
jupyter notebook
```

You should now be ready to do the tutorials :)