This repository holds code for a workshop run on April 23rd as part of UPenn MUSA program.
This workshop will cover techniques in utilizing Python and an open source stack of Python libraries for raster processing. We will go over how to load up raster data in Python using the rasterio library, working with rasters as numpy arrays, and performing analysis on satellite imagery. The workshop will include coding exercises run through a Jupyter Notebook.
Please make sure you can run the following steps before the workshop begins. If you have any problems with the setup, I'm happy to help. Put an issue on this repository with your issue, and we can work through it on GitHub.
To check your setup:
- Git 2+
- Docker - Docker for Mac, Docker for Windows, or regular docker. Install instructions for various OS's are here.
If you have a lot of trouble getting docker for working (especially with Windows), you might need to use an older method of running docker on Windows called DockerTools. A blog explaining this setup is here.
Clone this repository:
> git clone https://github.com/lossyrob/raster-processing-with-python-musa-2018
> cd raster-processing-with-python-musa-2018
This command will pull the base docker image and build on it locally. This pulls a pretty big docker image (1.2GB), so it's best to do this on a good internet connection.
> docker build -t musa/python-workshop -f Dockerfile .
> docker run -it --rm \
-p 8000:8000 \
-p 4040:4040 \
-v `pwd`/notebooks:/home/hadoop/notebooks:rw \
-v `pwd`/data:/home/hadoop/data:rw \
-v `pwd`/musa:/usr/local/lib64/python3.4/site-packages/musa:ro \
musa/python-workshop
Note: If you are on windows, you'll need to remove pwd
and set the volume to the notebooks
and data
directory manually. Here is a blog article talking about how to mount host directories into docker on Windows 10.
On Windows, you won't be able to copy paste this command as his. The \
that allows a multi-line command in Unix-like shells won't work; you'll have to collapse it into one line like:
> docker run -it --rm -p 8000:8000 -p 4040:4040 -v C:\some\folder\notebooks:/home/hadoop/notebooks:rw -v C:\some\folder\data:/home/hadoop/data:rw -v C:\some\folder\musa:/usr/local/lib64/python3.4/site-packages/musa:ro musa/python-workshop
Visit http://localhost:8000/. You should see something like:
You can log in with user hadoop
and password hadoop
.
After logging in, click no the notebook named Hello, MUSA!
. After the notebook is loaded, select Cells
-> Run All
to run all cells. You should see something like this:
You're ready for the workshop!