Welcome everyone to our introductory Python workshop. As we stated in the initial email, the purpose of this workshop is to help you dive into Python and do basic (or not so basic) data visualization, reading and writing files, prototyping processing workflows into reusable tools and more.
The dry details:
- When: Friday 27 July 2018; 09:30 - 16:30
- Where: CiTG KG 02.110
Preparations
We would like to jump directly into the workshop itself and not deal with support related issues on that day so please follow these steps prior to attending the workshop to get a functional python environment on your laptop.
If you have a working python environment you can skip the next step and go directly to step #2 but please follow step #3 to test your environment.
1. Download Miniconda:
Miniconda is a mini version of Anaconda that includes only conda
and its dependencies. Follow the installation instruction (Linux, OSX or macOS) to get started on your system.
In short, this will include:
- Downloading the
Miniconda3-latest-*-x86_64.sh
, where*
will be eitherMacOSX
orLinux
. - Installing miniconda by firing up the Terminal and typing:
1 2
cd Downloads/ bash Miniconda3-latest-*-x86_64.sh
- Agreeing to the license terms (type
yes
) - Accept the default install location proposed by the installer (press Enter)
- Allow Miniconda to prepend the install location to the PATH (type
yes
)
2. Install packages
Restart your Terminal so that the new entry to your PATH takes effect. You should now be able to type conda
in the Terminal command prompt and see the conda help message.
Conda is a smart tool for package, dependency and environment management for many languages. You can read more about it here, but you don’t have to.
To install the packages we need for the workshop copy and paste the following into the Terminal:
1
conda config --add channels conda-forge && conda install -y ipython notebook ipywidgets numpy scipy pandas gdal matplotlib basemap basemap-data-hires pillow cython sympy obspy
This may take a couple of minutes and will result is many other packages getting installed as conda takes care of package dependencies for you.
3. Test your environment
To make sure you are good-to-go, type jupyter-notebook
in the Terminal. A browser window should open and you should be able to start a new Python 3 Notebook.
Copy the following import
commands to the code cell in the newly opened notebook session:
1
2
3
4
5
6
7
8
9
10
import numpy
import scipy
import pandas
import gdal
import matplotlib
from mpl_toolkits.basemap import Basemap
import cython
import sympy
import obspy
import ipywidgets
Execute the code in the cell by pressing Shift
+ Enter
(⇧↩) or clicking the button.
It is alright if you get some warnings but if you get an error message please come see me so we can solve this before the workshop. If a new code cell is created like in the above screenshot you are good-to-go.