Resources for learning Python for Remote Sensing – or switching from IDL
I’m supervising an MSc student for her thesis this summer, and the work she’s doing with me is going to involve a fair amount of programming, in the context of remote sensing & GIS processing. She’s got experience programming in IDL from a programming course during the taught part of her Masters, but has no experience of Python.
I’ve just sent her an email with links to some useful resources, but in the spirit of Matt Might’s Blog tips for busy academics, I thought it would be worth doing a ‘reply to public’, and putting the list of resources here. So, here goes…
- Software Carpentry Python course:- this is designed for people new to programming, so some of it will be very easy for you. However, it takes you through a good example of scientific programming with Python, including plotting graphs and dealing with arrays. I suggest that you use the Jupyter Notebook to run through this – there are instructions on how to do that in the course, and there is a brief intro to the notebook in this YouTube video (start at approx 3 minutes – the stuff before that is irrelevantÂ for you)
- Lewis’s Scientific Programming for RS course (from UCL): – The most useful bits will probably be Python 101, Plotting and Numerical Python and Geospatial Data. Click the ‘Course Notes’ under each section to see the detailed notes.
- Python Scripting with Spatial DataÂ is also good – it gives a good intro to Python,Â and then covers spatial analysis using GDAL and RIOS (we won’t be using RIOS, but the GDAL stuff is good).
- Geoprocessing with Python using Open Source GIS: This is a very good set of slides and tutorials – along with assignments, homework tasks and solutions – from a course run at Utah State University. Unfortunately it is now very old – it was written in 2008/9 – and so it refers to a number of out of date things (such as the ‘numeric’ library for Python, which has been replaced by numpy). A lot of the GDAL content is still useful though – for example, this set of slides on reading raster data with GDAL is pretty good.
- There are various good tutorials from conferences such as SciPy (Scientific Python) and FOSS4G (Free and Open Source Software for Geospatial). For example, you can watch a video of a three-hour tutorial from SciPy 2015 called Geospatial Data with Open Source tools in Python, and you can find the slides and other resources here. This goes into quite a lot of depth, and new Python programmers may find it all quite daunting – but it demonstrates the nice modern ways of doing things (using libraries like Fiona and rasterio) rather than the less-nice and lower-level GDAL library.
- Another couple of resources (suggested by Chris Holden in the comments – thanks!) are the WUR Geoscripting resources, which start with R and then moves on to Python, and his own Open Source Geoprocessing tutorial, which covers GDAL and OGR, and demonstrates how to calculate NDVI and even goes as far as land cover classification.
There are also a few useful resources for switching from IDL to Python. Specifically:
- A Numpy referenceÂ for IDL users: Â (Numpy is the Python library that provides functions to manipulate arrays – unlike IDL, this isn’t included by default in Python – but it does come with the Anaconda distribution I mentioned above).
- I wrote a blog post comparing a set of ‘Ten Little Programs’ in IDL with equivalents in Python, which should give you an idea of the similarities and differences, and how you can translate some of your code.
This is a very short list of a few resources – I’m sure there are some better ones out there, and so please let me know if you’ve got any recommendations!
Categorised as: Academic, GIS, Programming, Python, Remote Sensing
Even after doing Python programming for three years, I found a lot of value in Matt Harrison’s book Beginning Python Programming: Learn Python Programming in 7 Days. It is short but comprehensive and gives some excellent insights regarding the features of the language. It includes good coverage of immutability of the different data types, which is often overlooked. The only, minor caveat is that it uses Python 2. I use Python 3, and it did not result in any problems worth mentioning.
I learned Python for /GIS in Python via #4 and it still holds as a great suggestion. I would point you to a few other resources below, but I would really love to see RS/GIS lessons from Data Carpentery — a sibling organization to Software Carpentry. There’s already a geoprocessing tutorial for R, and I’d love to collaborate toward a similar tutorial for Python:
– Geoscripting course material from some magnanimous folk at WUR: https://geoscripting-wur.github.io
– My own “open geo tutorial” that covers GDAL/OGR for land cover classification in R & Python: https://github.com/ceholden/open-geo-tutorial
Keep up the good work!
Thanks Chris – those look like really useful links. I’ll add them to the list in the main blog post (and credit you, obviously) – hope that’s ok.
I am an IDL programmer migrating to Python too.
Thanks for your helpful list