#2: NWS Hourly Weather Forecast


MicroProject collectable card

MicroProject Overview

The United States' National Weather Service (NWS) allows, for free, "developers access to critical forecasts, alerts, and observations, along with other weather data." When any organization provides developers access to data, the most common way to provide data is through an Application Programming Interface or API. An API is simply a documented and structured way that data is provided, so that a developer is able to use the data in a reliable and predictable way.

In this MicroProject, you will use the NWS Weather API to find the weather forecast for your location (anywhere in the United States!) and your MicroProject will always fetch the latest forecast the moment you run the code you will write! Let's nerd out with some weather data! 🎉

Required Libraries

This MicroProject has you create a data visualization! You will need to make sure to install the pandas and matplotlib library if you have not already done so. To do this, you can run the following command in the your terminal:

python3 -m pip install pandas matplotlib

Video Walkthrough

MicroProjects with Michelle #02: NWS Hourly Weather Forecast

MicroProject Preview

MicroProject Introduction, in Visual Studio Code
MicroProject Introduction, in Visual Studio Code
MicroProject Part 2.2, Hourly Forecast Data in a DataFrame
MicroProject Part 2.2, Hourly Forecast Data in a DataFrame
MicroProject Part 4, Scatter Plot of Forecast Temperatures
MicroProject Part 4, Scatter Plot of Forecast Temperatures
weather.gov API Documentation
weather.gov API Documentation

First Time Doing a MicroProject?

Each MicroProject starts with a notebook that we provide to you to get started! You will need to configure a git repository to connect to our `microprojects` remote where we release the starter notebook.


Fetch the Initial Files

In your terminal, navigate to your GitHub repository and merge the initial files by running the following commands:

git fetch microprojects
git merge microprojects/microproject-02-nws-hourly-weather-forecast --allow-unrelated-histories -m "Merging initial files"

Complete the Notebook

If the commands above were successful, you have merged in the initial files to start on the MicroProject.

  • Find the new microproject-02-nws-hourly-weather-forecast folder.
  • Open microproject-02-nws-hourly-weather-forecast.ipynb and complete the MicroProject!

Commit and Grade Your Notebook

Once you have finished your notebook, you must use the built-in GitHub Action to preform automated grading of your MicroProject notebook! You will need to commit your work and then manually run the GitHub Action.

Commit Your Work

To commit your notebook, run the standard git commands in your terminal:

git add -u
git commit -m "microproject completed"
git push

Grade Your Notebook

To grade your notebook, you will need to visit your GitHub repository in your browser.

  • Visit your GitHub repository in your browser
  • Click on the "Actions" tab
  • Under "Workflows", find the workflow for this microproject
  • Click the "Run Workflow" in the blue box, and then the green "Run Workflow"
  • After about 10 seconds, you should see a new job that has started running
    • You can click on the job to watch it run in real-time
    • It will take ~1 minute to run and grade
  • Once the running is complete, the autograding summary will be available!