Geology and Python

A blog stuffed with easy-to-follow Python recipes for geosciences !

Geoscientists! Read this before you start programming


DOI

I encourage you to read, understand and start using Docker before you start programming in Python.

Docker

What is Docker?

There is no better description for beginners, like us, than this one based on the Docker website:

Docker is a powerful system to eliminate the "work's on my machine" problem.

Ok, but what IS Docker?

Docker is an open platform for developers and sysadmins to build, ship, and run distributed applications, whether on laptops, data center VMs, or the cloud.

With Docker you will be able to run all the key Python packages for geosciences in your machine and don't even care to manually install tons of prerequisites like a specific Python version, gdal, HPGL and other tons of scientific packages. It also eliminate the chances of an app to be incompatible with your system.

You will be able to explore all the Python potential with just some lines added to a command line.

Why you should learn it even before start programming?

Docker is not over complicated stuff for IT professionals. If you sit, read the docs, understand Docker and be able to run a container you will save yourself from frustration and confusion in the future caused by incompatibility and complex apps installations. Trust me on this one. If you Google my name you may find some of my unanswered questions on how to install libraries and packages.

Also, you don't need to install lots of prerequisites and slow down your system just to use one specific package one time in your life and then let it rest in your memory for the eternity. Just run a container, do what you have to do, and remove it forever.

Keep reading

What is Docker? A Simple Explanation

This blog post is a nice way to understand the importance of Docker with some analogies involving real shipping containers.

Docker documentation

Some programmers don't like the official documentation, but I forced myself to understand Docker from there.

Starting right now?

Running Docker on Windows systems is a bit complicated, but there are tons of tutorials that will guide you. Just Google for docker for windows and add your version.

Also, if you are serious into programming in Python, consider Dual Boot with Ubuntu.

On Ubuntu all you need to do is open a Terminal and type

sudo apt-get update

and

sudo apt-get install docker-ce

Then, start pulling awesome Dockerized apps.

Docker for Geoscientists

geoscience-notebook is a Docker image with important libraries and Python packages for earth scientists. I created it because I was tired to install every piece of software every time I was going to use Python on a new computer.

This was built on top of a scientific Docker setup made by the Jupyter team called scipy-notebook. I added a couple more packages and made it geoscientific.

You can get my Python working environment just by pulling and running the geoscience-notebook image. Plus every time I update it, you can pull it again and keep up with the latest version.

Pulling and Running the image works just like the scipy-notebook.

Pulling the image

sudo docker pull brunorpinho/geoscience-notebook

Running the image

This will serve the notebook on port 8888 sharing the my directory /home/bruno/ with the container directory /home/jovyan/work. You can change /home/bruno/ to any directory that you want to share.

--rm will remove the container (but not your files) when you stop it.

sudo  docker run -it --rm -p 8888:8888 -v /home/bruno/:/home/jovyan/work brunorpinho/geoscience-notebook:latest
If you are making use of our methods, please consider donating. The button is at the bottom of the page.

Share on: