Sunday 30 August 2015

Software Carpentry workshop - University of Leeds

August 2015

By C.Scott Watson

Software Carpentry workshops are designed for PhD students and early career researchers wanting to develop programming skills to increase productivity. With a NERC funded workshop running on my doorstep as part of the Advanced Training Short Courses programme, I couldn't miss the opportunity to finally learn some coding.

I'd wanted to develop some Python skills since starting my PhD, and with no prior programming experience, this was the ideal opportunity. The workshop ran over three days, firstly introducing us to the Shell (Bash), before moving onto programming in Python and using version control in Git. The third day gave us the opportunity to work in small groups to put our new skills into practice on a small project. 


Day 1 summary

  • Navigating around directories using Bash and manipulating files
    • This led nicely onto using version control in Bash.
    • Version control is vaguely similar to using tracked changes on a work document but can track whole repositories of files and show the history of changes. It's particularly useful for collaborative projects where several people may be working on developing code.
    • Anyone working on the files can pull these repositories to their own computer, make changes to files and code for example, and then push those files back up to the repository so that other collaborators can access them.
  • Functions of Python relevant to environmental Scientists using IPython notebooks and how to document code so that it can be used by other people, or to remind you how it works months after you wrote it.
    • Leading on from this we the looked at how to build testing functions into the code to make sure it works as desired and produces the correct output.

The IPython notebook is a useful way of writing, testing, and documenting code before finalising it in a script:






Day 2 summary
  • More coding in Python including Matplotlib Basemap, which is useful for everything from making a simple overview map to plotting raster or vector data.
  • Using GitHub, which is the online interface for the version control we had been using in the Shell.
  • Looking at documenting code and choosing an appropriate license so that other can  use and modify the code.




Day 3 summary Our group project aim was to use Python to compare point and gridded rainfall data and we decided to use historical Met Office data, thinking this would be nice and easy to manipulate...only it turned out to be a bit of a nightmare. 

Our first task was using Python to download the text files containing the data for available weather stations using the Met Office URL. We then had to clean these text files to remove weird characters and replace no data values, before conducting some basic analysis and plotting up time series graphs. The mini project certainly put the time demands of apparently simple projects into perspective and got us using our newfound skills, including all collaborating through a Git repository.


The shell:




Plotting up our Met stations in Basemap:






Overall the workshop was a great three days and wasn't overwhelming for someone with no programming experience, but equally it seemed useful for those that already programmed in different languages or were coding on a daily basis as part of their PhD. All the instructors and assistants made sure the workshop ran as smooth as it could and the lessons were hands-on and run interactively on the projected displays, so it was generally easy to follow on your own laptop.