Current Weather Forecast

Introduction

The National Weather Service (NWS) API allows developers access to weather forecasts, alerts, and observations, along with other data. The information obtained via the API is open data and free.

Read the NWS API documentation and examples. Use it in the projects.

Latitude/Longitude

To obtain the most accurate weather data for a location you will need its latitude/longitude. Click here for a web based latitude and longitude finder.

Project #1

Display the current weather for your location.

Display/format the data in a pretty/readable/useful format. If you have the time and the inclination use PySimpleGUI and create a nice GUI display.

Project #2

Given the following forecast data, plot the 7 day high and low temperatures.

# 7 day forecast on 08/07/2022 23:25:53 [ 1] Tonight 62 deg-F [ 2] Saturday 89 deg-F [ 3] Saturday Night 63 deg-F [ 4] Sunday 90 deg-F [ 5] Sunday Night 62 deg-F [ 6] Monday 89 deg-F [ 7] Monday Night 61 deg-F [ 8] Tuesday 86 deg-F [ 9] Tuesday Night 60 deg-F [10] Wednesday 87 deg-F [11] Wednesday Night 62 deg-F [12] Thursday 89 deg-F [13] Thursday Night 65 deg-F [14] Friday 92 deg-F

I suggest you use the pyplot or related modules.

matplotlib.pyplot (documentation and examples)

Project #3

Using the current forecast for your location, plot the 7 day high and low temperatures. (Same as Project #2 but different/current data.)

Project #4

What climate data is available? Pick some, plot some.

National Centers for Environmental Information

Sample Code

Code Sample #1
Code Sample #2

Links

How to use the weather.gov API
National Weather Service (home)
National Weather Service Web API (documentation)
10 Best Python Weather API Libraries
Getting the Weather With Python
How to use the NOAA API to query past weather data for a given set of coordinates
JSON encoder and decoder
Python Requests Module Documentation