Computer Labs
This section contains a growing collection of Python computer labs that support this course. The student notebooks are available in the Colab repository.
👉 github.com/water-course/colab-tutorials
They are fully executable and designed to be loaded into Google Colab, an online Python notebook environment provided by Google. Each lab comes to you with its code cells left blank for you to fill in.
In addition, executed versions of these labs (with all answers) are rendered directly on this site using the mkdocs-jupyter plugin. These are meant to help you follow the logic and confirm your own solutions.
Try it yourself first!
All answers are available — but that is not the spirit of things. You are encouraged to first try solving the problems in Colab or on your local machine before reading the provided solutions. Programming and data analysis are learned by doing.
⚙️ What is Google Colab?
Colab is a free Jupyter notebook environment that runs in the cloud. It allows you to:
- Run Python code without installing anything locally
- Use a notebook interface similar to JupyterLab
- Access notebooks directly from GitHub
- Use free cloud-based GPUs (optional)
Tip
Sometimes Colab may not have all required libraries pre-installed. For example, cartopy is not available by default.
To install it inside a code cell:
!pip install cartopy
Replace cartopy with the name of the missing library as needed.
▶️ How to load the labs from Colab
Below is a short demo showing how to load the full Jupyter notebook directory into Google Colab:
- Visit colab.research.google.com
- Go to the GitHub tab
- Paste
water-course/colab-tutorials - Select the notebook you want to work on
If a notebook does not appear in the GitHub tab, download the .ipynb file from the repository and use Colab's Upload tab instead.
📘 Lab List
Lab 1
A beginner-friendly introduction to Python programming for geoscience applications, covering basic maths, loops, formatted output, and simple map plotting with Cartopy.
Open the student notebook in Colab
Lab 2
Learn how to perform geospatial analysis in Python by working with shapefiles and spatial queries, streaming gridded NetCDF rainfall straight off NCI's THREDDS server over OPeNDAP, building a basin mask, and averaging monthly rainfall over the Murray-Darling Basin.
Open the student notebook in Colab
Lab 3
Work with the same gridded rainfall using xarray, where named dimensions and coordinates travel with the data: opening a remote file lazily over OPeNDAP, selecting by label with .sel rather than by position with .isel, the descending-latitude slice that silently returns nothing, plotting straight off the array, and re-binning monthly totals into complete calendar years with resample.
Open the student notebook in Colab
Lab 4
Learn a practical approach for adjusting surface-area differences across latitude–longitude grids, deriving the exact grid-cell area on a sphere and applying it to GRACE satellite data.
Open the student notebook in Colab
Lab 5
A standalone lab on estimating missing rain-gauge values from surrounding stations, comparing several interpolation methods on real storm data — adapted from a tutorial by Jesús Casado Rodríguez.
Open the student notebook in Colab
📂 Access all notebooks: github.com/water-course/colab-tutorials