Jupyter Notebooks and Satellite Imagery

I have been meaning for the last 6 months to write about Jupyter Notebooks and why they are the perfect toolbox for working with Python and Satellite Imagery. I like Notepad ++ a great deal, it is simple and easy to use and will remain my default choice for the time being for writing code. However, I find that for teaching geospatial Python, Jupyter Notebooks are an incredibly useful way of learning and documenting code. They also provide that all important fast feedback within the browser and they are an excellent visual record.

I am seeing more Jupyter Notebooks being created that are focused on EO and GIS. For example, Digital Globe,Planet and ESRI are increasingly building notebooks (see an ESRI guide here). I am sure there are plenty of others – please do share if you happen to know of any. Whole books are being presented as Jupyter Notebooks, for example this one on Python Data Science. So what are you waiting for?

Installation (windows)

It is super simple. Assuming you have Python installed with Pip, these are the commands:

for Python 3 –

python3 -m pip install jupyter

or for 2.7

python -m pip install jupyter

Once installed just call the following at the command line:

jupyter notebook

It is that easy. No reason not to install it if you are already familiar with Python. Look for the button on the right called ‘New’ and create your new Notebook. Or you could import one. Any libraries already installed are available through the usual import call. So you are ready to code.

Viewing your first Satellite image in Jupyter Notebooks

There are several ways of doing this; all the ways I know use Matplotlib. This seems the simplest way. Note I am using a .jpg image:

Using notebooks allows you to display multiple images or graphs alongside each other using the Matplotlib subplot. Here I convert the RGB image above to HSV (Hue, Saturation and Value) and plot alongside the RGB image.

Note that in OpenCV the HSV range is: H: 0 to 179 S: 0 to 255 V: 0 to 255.

Hopefully the benefit of being able to see information about your imagery alongside the imagery itself in one continuous web page will be apparent.

More to come

This was just an introduction; the notebook is available on my GitHub page here. It makes quite easy reading. And in that one sentence it demonstrates why using Juypter Notebooks is such a compelling reason to share your code and projects.

I am a freelancer able to help you with your projects. I offer consultancy, training and writing. I’d be delighted to hear from you.