Summary and Setup
Almost all research involves writing code, whether it is a small script for data analysis, or a vast simulation package. The longer a project goes on, the more code gets developed, and the more changes you inevitably need to make. Keeping track of what you are doing, were doing, and will be doing becomes increasingly difficult. Then, when a project is finished, all the information on how you solved the problems you faced and even the code you made often goes to waste.
This workshop covers how we can make sure our code is easy for us to share and work with, as well as easy for other people to cite so we can get credit for the effort we put in.
Premise
You have been handed some data analysis code written by a previous PhD student, that is intended to load and analyse files containing climate data. It’s difficult for anyone else to pick up and use, or modify further. You’ll make it a bit easier and clearer, using some simple processes and tools.
This lesson uses Git and GitHub. You should be able to:
- Commit changes to files to a repository.
- Have a basic idea of how branches work.
- Have a GitHub account.
- Have previously hosted a repository on a site like GitHub, GitLab or Codeberg.
The code used in this lesson is Python, but experience with any programming language is enough - the code is just for demonstration purposes.
Accounts
We’ll be using the website GitHub to host, back up, and distribute our code. If you don’t already have one, you’ll need to create an account there. As your GitHub username will appear in the URLs of your projects there, it’s best to use a short, clear version of your name if you can.
Repositories
Follow-on Lesson
If you’ve completed our Version Control with Git
workshop, you can use the climate-analysis repository you
created during it.
We’ll be showing you how to manage an example academic software
project, using a simple example. Create
a copy of the example from this template (linked here), and name it
climate-analysis.
Software Setup
This workshop involves editing code files. Whilst you can use any text editor to do this, some code editors or Integrated Development Environments (IDEs) have features designed to make coding easier.
If you’re already using a code editor or IDE (e.g. Atom, Sublime Text or Spyder), stick with what you’re comfortable with. If not, we’d recommend installing Visual Studio Code.