Weather Data Science

A STEM outreach activity using data science and machine learning techniques to analyze weather data.

  • Time: 60 - 120 minutes+
  • Age: Middle School and Up

Teacher Introduction Video

YouTube Video

Starter Code

The starter code can be found on GitHub. This repository is a template that can be easily forked by students or teachers to their own accounts.

The files can also be downloaded as ZIP file from the 1.0 Release and then redistributed through a course LMS or other process.

Teacher Setup

For students to follow along with this activity, they need access to system with Python and Jupyter Notebooks installed and available. There are many possible configurations that work, which are discussed below. If you have questions or need assistance setting things up, reach out to altcs AT ksu DOT edu and we’ll do our best to help!

Simple - Local Installation

The simplest setup is to have Python and Visual Studio Code installed on the system locally. Then, within Visual Studio Code, install the Python and Jupyter extensions. If the folder containing the starter files are opened in Visual Studio Code, you should be prompted to install those extensions if they aren’t already installed.

Devcontainers and GitHub Codespaces

The starter files also contain a .devcontainer folder that can be used to create a local [Development Container] using Docker, or a cloud development environment using GitHub Codespaces. That environment will contain the Python installation and handle installing the required extensions and libraries. Students can create their own copies of the starter code using the template repository on GitHub.

Codio

The Codio platform supports Jupyter Notebooks and could be used to deliver this lesson. Teachers will need to configure the lesson in Codio for students to use.

Google Colab

Google Colab is another possible option for students to engage with this lesson online. Students can start by clicking on the link below to open the starter file in Google Colab (the same link can be found on GitHub).

Open In Colab Open In Colab

It requires a bit of additional configuration:

  • Run the code block at the top of the file to clone the repository and install the required libraries.
  • Remember that all Python commands must be run within code blocks and not the terminal. See the example included in the starter notebook.

Model Solution

The starter repository contains a solution folder that contains the intended model solution at the end of the activity. Since this activity is meant to be exploratory in nature, it can be helpful to give students an option to either write the code themselves or follow along with a model solution and make changes to the existing code. Teachers may choose to remove that folder if they redistribute these materials.

Lesson Plan

The lesson itself is broken into several parts. Teachers can build upon these parts by adding additional discussions, data sources, and activities.

Subsections of Weather Data Science

Gather Data

Video Walkthrough

YouTube Video

Resources

Teacher Notes

You can expand upon this section by linking it to discussions around local weather patterns or a larger module on the climate and weather in general. Students could be encouraged to collect their own weather data for a time period and use that data in this activity (with a bit of formatting help). While this activity is rooted in weather data, the same basic process can be used to analyze data of all types.

Clean Data

Video Walkthrough

YouTube Video

Resources

Teacher Notes

When doing this as part of an outreach activity, often this section is just a discussion and the full clean_data.py script is provided to students so they can quickly clean their raw data and move ahead to the next part. However, this can easily be expanded to a larger activity to actually build and test the clean_data.py script or perform additional data cleaning processes in a spreadsheet program.

Also, it is worth noting that the clean_data.py script as provided has a commented out line that does not process any missing data (denoted by an "M" in the Kansas Mesonet data) - that will be handled later in the lesson when it becomes an issue.

Graph Data

Video Walkthrough

YouTube Video

Resources

Teacher Notes

This section is the main interactive part of the lesson. Students should be given plenty of time to type in the code to load the data and create at least the first graph of the data. Depending on time and interest, the activity can slowly shift from having students write the code to having students follow along with the example solution to add more complexity to the graphs and answer the underlying questions posed at the beginning of the lesson.

Machine Learning

Video Walkthrough

YouTube Video

Resources

Teacher Notes

This section is mainly a deeper demonstration of some machine learning concepts and models that can be used in Python. The goal is to use the students’ current understanding of data science concepts and expand upon that using some more advanced techniques. The actual techniques presented here are mostly for demonstration purposes and aren’t really meant to be statistically valid for the input data (though they do produce some interesting results nonetheless). AI coding tools are a great way to give students the power to explore this data in more detail if they are available (most of the model solution code in this section was generated using an AI tool).