Weathered
VisitGitHubWhy?
Sometimes, when I want to go mountain biking, the trail is out of town. Oftentimes, trails are closed when it has rained recently and the trails are wet. So, I want to know what the weather was like recently in that area so I can determine if the trail will be good to ride.
However, it is somewhat difficult to find accurate historical weather!
Why is it is challenging to get recent actual weather?
A few years ago, I wanted to make this app. I was using a weather API that would give me the current weather in any location. So, in order to not go over my usage limits, I only had a couple locations that I would search for.
Every 30 minutes, my script would call this API and record the current weather. If it was raining, it would tell me so, so at the end of every day I could add all the rainfall up and get a total rainfall for the day.
But I started noticing that the past day's weather would not reflect reality! How could this be?
Apparently, what I was actually requesting was a time interval's FORECAST, not the actual data. I searched and searched, but I could not find a weather data API that fit all my needs.
I became interested in this project again in December 2023, when a friend wanted to go mountain biking, but we didn't know if it had rained at that location recently, which would close the trail.
During research, I learned that the reason I couldn't find what I was looking for was because of how this weather data works.
Weather data comes from STATIONS, and these stations are real, physical things that report their weather data to different agencies. They are not magic, and they take time to report their data.
I learned about the NOAA's (National Oceanic and Atmospheric Administration) GSOD (Global Daily Summary of the Day) Dataset. This dataset contains over 13,000 stations all over the world that report their daily weather summaries.
They also have an easy-to-use API that I tried to use, but I kept noticing that the data would be a few days behind, if not more. This wouldn't work!
So I had to use the datasets directly! Look below at the GSOD Data Processor project for how I did that, it was fun!
How?
Anyway, this app is simple, and it was my first time using Blazor. I originally wrote it all as a Blazor Server app but rewrote it to use Blazor WASM and a .Net Web API.
When you search for a location, the app makes a request to the Google Maps Geocoding API in order to get the Latitude and Longitude. I then query my database, which is populated by my data processor, to get a group of nearby stations. I then do a little calculation to get the nearest station.
A lot of times, unfortunately, yesterday's weather data hasn't been posted by the station. In this case, I do the next best thing, and get whatever missing past day's forecast, which should be a decent approximate until the data comes in.
The result is the past 6 days of weather data, and I mark which ones are predictions and which are actuals.
With What?
Blazor WASM, .Net 8 Web API
Google Maps API (Geocoding, Time Zone), Pirate Weather API, NOAA GSOD Dataset