Urgent.News

What's breaking now, across thousands of outlets.

Tech

Building a Snowfall Trigger Alert for Plow Dispatch in Buffalo, NY (Python + NWS API)

If you've ever lived through a Buffalo winter, you know the forecast for "the city" means very little. Lake-effect snow bands can drop a foot on Orchard Park while downtown gets a dusting. For a snow plowing crew, that creates a real scheduling problem: when do you actually send trucks out, and to which neighborhoods? Most residential and commercial snow contracts use a trigger depth , typically…

Snowfall forecasting in Buffalo, NY, can vary significantly due to lake-effect snow bands. These bands may deposit a foot of snow on some areas while leaving others with only a light dusting. This creates a scheduling challenge for snow plowing crews, who must determine when to dispatch trucks and which neighborhoods to target. A typical trigger depth for initiating plow visits is around 2 inches.

To address this issue, a Python script has been developed to check the forecast snowfall for multiple points along a service route and determine if the trigger is likely to be reached within the next 24 hours. The script utilizes the free National Weather Service API, which does not require an API key, as long as a descriptive User-Agent header is included.

The National Weather Service API consists of two main steps. First, the script calls the /points/{lat},{lon} endpoint to identify the forecast grid cell that covers the specified location. Second, it fetches the gridpoint data for that cell, which contains a snowfallAmount time series. Each value in the snowfallAmount series has a validTime, indicating the time period during which that amount of snowfall will occur.

The amounts are provided in millimeters. To implement the script, a helper function called get_grid_url() is defined to generate the URL for retrieving the forecast grid data based on the provided latitude and longitude. The script then defines another function, snowfall_next_hours(), which calculates the total snowfall expected within the next 24 hours for a given grid URL.

To handle forecast periods that do not align neatly with the 24-hour window, the function only counts the overlapping portion of each forecast block and assumes that the snow falls evenly across each block. This simplification, while not entirely accurate, is sufficient for establishing a snow plowing trigger.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

TrialMatch: Why Precision Matters When Lives Are on the Line

This is a submission for the Sanity Challenge, Path One: Ship an Agent That Queries Real Content What I Built A few months ago, a friend’s aunt was diagnosed with advanced non-small cell lung cancer.

  • Woman with advanced lung cancer faces dire situation after chemotherapy stops working
  • AI tools produce fabricated clinical trial identifiers, risking patient selection
  • TrialMatch uses structured content lake and Boolean rules for precise trial selection

useState in React

When building interactive web applications with React, we often need to store values that can change over time. For example, a counter value can increase, a user's name can change, or a login status…

  • useState Hook enables functional components to create and maintain state
  • Syntax: const [ state, setState ] = useState(initialValue)
  • Direct state modifications discouraged, use setter function setState

More from Wednesday 30 September →