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!
- A review of basic Python syntax and operators.
- An introduction to making use of Git+GitHub.
- An introdution to making use of the Shell/Terminal.
- 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.
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
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:
To run the code for these sessions you can:
- Follow the instructions for running these in Google’s Collaboratory; or
- Create a new Notebook in Docker (
File
>New
>Notebook
) and copy+paste the code into newCode
cells.
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:
References
Footnotes
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!↩︎