Foundations (Pt. 1)

Overview

This week we will be quickly covering the fundamentals of Python programming, while developing a critical appreciation of data science as an ongoing ‘process’ that calls for iterative improvement and deeper reflection. We will be contextualising computers within a wider landscape of geographical/spatial research. We will also be looking to the Unix Shell/Terminal as a ‘power user feature’ that is often overlooked by novice data scientists. And we will be (briefly) reviewing the basics of Python with a focus on simple data structures. We’re focussing here on how computers ‘think’ and how that differs from what you might be expecting as an intelligen human being!

Learning Objectives
  1. A review of basic Python syntax and operators.
  2. An introduction to making use of Git+GitHub.
  3. An introdution to making use of the Shell/Terminal.
  4. An understanding of how none of this all that new.

So we will be contextualising all of this within the longer history of the study of geography (or planning!) through computation. I hope to convince you that many of the problems we face today are not new and why that should encourage you to continue to do the readings!

Lectures

This week is very busy because we need to cover off the basics for those of you who were unable to engage with Code Camp, while recapping only the crucial bits for those of you who were able to do so.

Come to class prepared to present/discuss:

Session Video Presentation
Computers in Urban Studies In Class Slides
Principles of Programming In Class Slides
Python: the Basics Video Slides
Lists Video Slides
Iteration Video Slides
The Command Line Video Slides
Getting Stuck into Git Video Slides

Other Prep

  • Come to class prepared to present/discuss:
  • Complete the short Moodle quiz associated with this week’s activities.
Readings

You should read Burton (1963) and Arribas-Bel and Reades (2018) with a view to seeing that ‘there is nothing new under the sun’: we tend to think that the challenges we face now in terms of data volumes and complexity are novel, but they are not. Indeed, here’s John Graham-Cumming keynoting a 2012 conference talking about the Lyons Tea Company and how its programmers invented Dykstra’s shortest path algorithm more than 20 years before Dykstra did!

Installing the Programming Environment

Warning

This week’s practical requires you to have completed installation of the programming environment. Make sure you have completed setup of the environment.

In principle, we fully support students who want to do things their own way; however, we are also not able to sit down with each person and develop a custom learning environment. With Docker, we can give you full access to the cutting-edge Python libraries and other tools needed to ‘do’ spatial data science, while only needing to install 1 application, download 1 (big) file, and run 1 command. When it works… There are alternatives, but there are more things that can go wrong and they can go wrong in more complex ways. Solving the Anaconda environment can take several hours before it even starts installing.

So here’s what we ask: if you already know what to do with an Anaconda YAML file, or can work out how to edit the Dockerfile and build a new image, then by all means knock yourself out! We are not going to tell you that cannot do something, and eventually you will need to learn to stand on your own two feet. But please do not expect us to support you individually if you’ve gone off and done your own thing and ‘it doesn’t work’. OK? We’ll offer advice (if we can) but only if no one else is waiting for help.

Practical

This week’s practical will take you through the fundamentals of Python, including the use of simple1 Boolean logic and lists. However, if you have not yet completed Code Camp (or were not aware of it!), then you will benefit enormously from tackling the following sessions:

  1. The Basics
  2. Boolean Logic
  3. Lists

To run the code for these sessions you can:

  1. Follow the instructions for running these in Google’s Collaboratory; or
  2. Create a new Notebook in Docker (File > New > Notebook) and copy+paste the code into new Code cells.
Connections

The practical focusses on:

  • Ensuring that you are set up with Git/GitHub
  • Reviewing Python basics
  • Reviewing Python lists and logic

To access the practical:

  1. Preview on GitHub
  2. Download the Notebook

References

Arribas-Bel, D., and J. Reades. 2018. “Geography and Computers: Past, Present, and Future.” Geography Compass 0 (0):e12403. https://doi.org/10.1111/gec3.12403.
Burton, I. 1963. “The Quantitative Revolution and Theoretical Geography.” The Canadian Geographer/Le Géographe Canadien 7 (4):151–62. https://doi.org/10.1111/j.1541-0064.1963.tb00796.x.

Footnotes

  1. Note: simple does not mean ‘easy’! Just because we say something is ‘basic’ or ‘simple’ does not mean that we think it is straightforward for someone learning to code for the first time!↩︎