Python 101: Retrieve weather alerts using the NWS API
One of the most common needs and use of weather information is to stay on top of breaking severe weather events. In a previous post, we explored using the NWS API to retrieve the current forecast for a specific location. Let’s walk through how you would retrieve any active weather alerts for your area.
Python 101: Geocoding for a location with Nominatim
Many APIs that provide location-specific information require information like an address or geographical coordinates to provide the correct data. Some APIs specifically require longitude and latitude coordinates for successful calls. How do you get that information for a specific location? In the past, it has not been easy to find, but many services now provide geocoding. I’ll share a sample using an API that Nominatim/OpenStreetMap exposes to retrieve the necessary information.
Python 101: Pulling the weather forecast with the NWS API
Although Python might be a 30-year-old programming language, it’s an easy language to adopt, provides a lot of capability through external libraries, and is supported on major operating systems like Linux, Windows, and Mac OS. Likewise, there are plenty of weather data sources to retrieve information like current conditions, forecasts, and severe weather alerts. The National Weather Service (NWS) API allows developers access to critical forecasts, alerts, observations, and other weather data. The API was designed with a cache-friendly approach that expires content based on the information lifecycle. All the information available via the API is open data and free to use.
I’ve been a technologist for over 20 years, getting my start in IT with a large Fortune 100 international retailer in the 1990s. I love to talk about new technology, mobile devices, software development, photography, and the weather. The opinions expressed on this website are my own.