Tech4Housing / kcrha_weather

MIT License
2 stars 0 forks source link

Add precipitation metric collection #3

Closed JeffreyGreenII closed 6 months ago

JeffreyGreenII commented 9 months ago

KCRHA expects this alert to be able to collect information on precipitation (measurements in inches) for both predicted rainfall and snowfall forecasts.

JeffreyGreenII commented 8 months ago

Potential Data Sources

Rain

Liquid precipitation (this is their language, not mine) data may be derived from the Weather Prediction Center (WPC) in the form of Quantitative Precipitation Forecasts (QPF) and Probabilistic Quantitative Precipitation Forecasts (PQPF) products.

Documentation on both can be found here:

Furthermore, there is additional rain-related dashboards and forecasts, such as the Excessive Rainfall Forecast and Significant River Flood Outlook products.

Snow

Winter weather precipitation may be derived from the WPC's Winter Weather Forecast (WWF) product (Documentation for the WWF product). The WWF breaks down it's precipitation forecasts into 2 categories:

  1. Snowfall
  2. Freezing rain

Data Formats & Availability

Rain

Formats

The QPF's are available as GRIB2, Shapefile, and KML formats (seen here), while PQPF's seem to only be available via the GRIB2 format (seen here).

Availability

For brevity's sake, I will cover only the GRIB2 type of forecast format offered for QPF, to give context to the type of forecast breakdowns offered. QPF's seem to be available for a 7-day period with differences between the first 3 days of forecasts and the last 4 days of forecasts. For the first 3 days, each forecast covers 6 hour spans (eg, 00-06 hour forecast, 06-12 hour forecast, ..., 30-36 hour forecast, etc.). However, there also exists longer span reports for the first three days, as well, offering 24/120/168 hour span forecasts, such as 24/48/72 hours. Lastly, the 5-day and 7-day forecasts are only available via 120 hour and 168 hour forecasts.

While PQPF's only seem to project out 3 days or 72 hours, providing a 6 hour, 12 hour, 24 hour and 72 hour forecast.

Snow

Formats

The WWF seems to also offer GRIB2, Shapefile and KML formatted files (seen here for Shapefile/KML links and individual forecast links offer GRIB2 format download links).

Availability

The WWF seems to only predict precipitation amounts out by 3 days or 72 hours, but offer 1 day, 2 day, and 3 day forecasts.

Collecting the data

All data seems to be hosted as individual files, each containing some or all of the specific forecast, which are hosted via an FTP server.

To collect the 7-day forecast of each of these would require fetching between 1-7 forecast files (depending on the granularity of the forecast data within each file) per data point (ie, 1-7 QPF or PQPF forecast files, 1-7 snowfall forecast files, and/or 1-7 freezing rain forecast files).

Below are the FTP server locations of the aforementioned forecast files:

Finding the forecast files on the FTP

While I'm not certain the exact naming strategy for all forecast files, the strategy for most files on the FTP server seem to follow a pattern as such:

p{$length_of_forecast}m_{$date_of_forecast}{$hour_of_forecast}f{$end_time_of_forecast}

Where:

Parsing the data

At present, I'm not sure how to use any of these data types (GRIB2, Shapefile, or KML) to collect the necessary data about predicted rainfall.

JeffreyGreenII commented 8 months ago

Hoorah! It seems like it's not a well-documented feature, but after reviewing the NWS endpoints again (for what feels like the 100th time), it turns out that there is a RAW forecast endpoint for individual gridpoints, which will provide a 7-day forecast with quantitative precipitation estimates!

https://api.weather.gov/gridpoints/SEW/125,69

JeffreyGreenII commented 6 months ago

Added with #4