Almost Real-Time Weather System
-
Original Post:
https://github.com/thenomain/Mu--Support-Systems/tree/master/Weather
This is the code originally written for Darkwater years ago in order to pull real-time weather conditions around Forks, Washington.
Since then I've tweaked it, its source changed from Yahoo to Weather Underground, and given installation instructions that should make it a lot more accessible.
Please use. Please comment. Please enjoy. Thanks.
--
UPDATE FEB 24, 2019: This system is defunct. Please read this post below for more info.
UPDATE MAR 17, 2019: We're back on Dark Sky. Github has been updated with the new system and instructions.
-
You really do make all the shiny things.
-
He IS a shiny thing!
Request: Please tweak code to be sunny all the time (except between the hours of 3am and 6am, when it can rain so human life might be sustained) IRL.
-
@VulgarKitten Just use SoCal instead of Forks. Done -- except for the raining ever thing.
-
Reminds me of the code I had on Angelic Layer MUSH. I had a CRON running that'd store data into SQL after grabbing from weather underground. As Angelic Layer MUSH was 2 years behind real-world, and weather underground had historical METAR data, I could grab stuff form the Tokyo Airport.
Don't think they had an API at the time. And just reading their pages was a bit annoying.
-
Screen scrapes are always a pain. Thank goodness for JSON and APIs
-
@Thenomain
Damn right it was a PITA.But hey, it taught me Regular Expressions, so... win/win?
-
@Mercutio https://xkcd.com/208/
Ahem.
If anyone hasn't checked this out and wants to, I'd like to highlight my absolute favorite feature: It calculates moon phase and calculates if the moon is visible (via moonrise and moonset). Super important when looking up to see the full moon!
-
I'm currently working out the math to report on tides, including the high/low chart and the current height. This is, er, interesting because it involves sea-level estimates. If there is something more complex than the exact moon phase, it's tides.
My desire to see a Pirate Mu* drove me to this.
While I'm armpit-deep in the weather system code, is there anything that people wished was in weather code but wasn't? I'm planning a
weather()
function to this, since why not, but what else might anyone want? -
@Thenomain said in Almost Real-Time Weather System:
While I'm armpit-deep in the weather system code, is there anything that people wished was in weather code but wasn't? I'm planning a
weather()
function to this, since why not, but what else might anyone want?I can't recall, but how much data was available to you from the API? Like, I know we have "next day", but do we have a multiple day forecast?
-
@skew said in Almost Real-Time Weather System:
I can't recall, but how much data was available to you from the API? Like, I know we have "next day", but do we have a multiple day forecast?
3-Day Forecast:
https://www.wunderground.com/weather/api/d/docs?d=data/forecast10-Day Forecast:
https://www.wunderground.com/weather/api/d/docs?d=data/forecast10day -
@Thenomain So make a 10-day forecast version!
The only other thing I could really ask for is a simple one-line output. Something like...
weather/short -->
It is currently 78°, with a high of 82° and low of 52°. It is raining. The moon is full, but not visible.
-
Weather Underground has been purchased by The Weather Company, and while I'll miss Wunderground it's nice that they have a pay-out for all their efforts.
They were called Weather Underground because they were taking the information available for free via NOAA and presenting it to everyone on this young system called "The Internet", and not asking for money. It was a passion project that grew up, and now it's passed on into the great beyond of Things Getting Bought Out.
The bad news is that they no longer have a "free" (probably supposed to be short-term) demo API that did everything we needed to do, and more. Current conditions, forecast, tide information, moon and sun information, it was amazing what information they would give out. This means that this system is now defunct.
While the most popular aspect of the Almost Real-Time Weather System was the moon information, I'm looking through systems to reinstate it. So far the following systems are on the radar:
- NOAA: https://www.ncdc.noaa.gov/cdo-web/webservices/v2 & https://forecast-v3.weather.gov/documentation
Benefits: Always Free, It's Friggin' NOAA, there's a good Python 3.1 object class for this
Drawbacks: Getting the full information is a pain in the patoot, no moon info, no tide info - Open Weather Map: https://openweathermap.org/api
Benefits: Always Free
Drawbacks: Not the most straightforward but pretty solid, no moon info, no tide info - Dark Sky: https://darksky.net/dev/docs
Benefit: Passionate developers like Wunderground in its day, moon illumination
Drawback: Freemium like Wunderground was threatens the 'free' part of that getting pulled in the future, no moon rise/set, no tide info
And the piece de resistance, for the werewolves out there:
- US Navy's Astronomical Applications API: https://aa.usno.navy.mil/data/docs/api.php
Benefit: Free, full information, loooots of information
Drawback: Not wrapped into any other service
The missing information that I could get from just one call from Wunderground is tide estimates. This is not critical for most games, but damn I kind of want it now that I don't have it.
Updates as I have them.
Sorry about this, Mushers.
- NOAA: https://www.ncdc.noaa.gov/cdo-web/webservices/v2 & https://forecast-v3.weather.gov/documentation
-
We're back.
Sure, it took a lot of pushing from Echoes in the Mist, but anyone who wants live weather and live "is the moon visible?", follow the directions at the original Github location at the first post in this thread.
Thanks.
-
Very neat. You could do this on PennMUSH using the
@http
command without the PHP backend and news file interface. -
Cool.
Having a structured programming language do the heavy lifting is well worth it, to me. Scraping a news file is trivial in comparison, and the only reason I scrape it is because I capture more information than I use.
-
-
Clearly that book written in (checks) 1995.
Wait, really? 1995? There's got to be an appendix containing languages PHP is better than.
Like Mushcode.
And Pascal. Just sayin'.
-
So the US Naval Observatory's API (which I've been using for astronomical data, specifically moonrise/moonset and moon phase) is being moved (or has been moved—the navy's site structure is in disarray right now) and therefore is no longer accessible.
@Ashen-Shugar has pointed me towards moon rise/set code (in Python, woo!), and Dark Sky has "lunar age" and with a bit of help from science-math nerd @Tributary I should easily get this translated to illumination...
...but I really want to flip a table right now. Playing data whack-a-mole with data sources is frustrating.