Saturday, February 16, 2019

NOAA weather data

Resources discussed in this post:

This post is just about using public weather data to display a temperature in my windowing environment, but at some point I’d like to use it as a jumping off point for more deeply exploring the available data. It’s really cool how much of this stuff is available as simple text files and the like. Your tax dollars at work, but in a good way.

I use xmonad for window management, and along with it a simple status bar called xmobar.

xmobar offers some monitoring plugins that display various bits of system status and other things. One of them is a weather plugin that can grab temperature and other values from NOAA-supplied weather data. I’ve been using the temperature from a METAR site at Denver International Airport, code KDEN, but I wondered if there was something closer to home available.

I always have the vague sense that there’s a ton of public weather data like this out there, but I don’t have a very good mental map of where it lives and I usually wind up fumbling around until I hit a directory full of text files on some FTP site. The docs for xmobar also aren’t very clear on what the station codes actually reference.

Some notes follow for the next time I’m thinking about this.

xmobar’s weather plugin (source on GitHub) uses decoded METAR station data, available in text files from tgftp.nws.noaa.gov. The path to the site is, at this writing, hardcoded in the plugin.

METAR itself (“Meteorological Aerodrome Reports”) is evidently a standard that’s been around since 1968 in some form. The data looks something like this:

$ curl --silent https://tgftp.nws.noaa.gov/data/observations/metar/stations/KDEN.TXT
2019/02/16 21:48
KDEN 162148Z 36016G27KT 1 1/2SM -SN BKN022 OVC026 M02/M05 A2952 RMK AO2 PK WND 36027/2142 WSHFT 2118 SNB2057 P0000

And NOAA also offers decoded versions, which is what xmobar is parsing:

$ curl --silent https://tgftp.nws.noaa.gov/data/observations/metar/decoded/KDEN.TXT
DENVER INTERNATIONAL AIRPORT, CO, United States (KDEN) 39-52N 104-40W 1640M
Feb 16, 2019 - 04:48 PM EST / 2019.02.16 2148 UTC
Wind: from the N (360 degrees) at 18 MPH (16 KT) gusting to 31 MPH (27 KT):0
Visibility: 1 1/2 mile(s):0
Sky conditions: overcast
Weather: light snow
Precipitation last hour: A trace
Temperature: 28 F (-2 C)
Windchill: 15 F (-9 C):1
Dew Point: 23 F (-5 C)
Relative Humidity: 79%
Pressure (altimeter): 29.52 in. Hg (999 hPa)
ob: KDEN 162148Z 36016G27KT 1 1/2SM -SN BKN022 OVC026 M02/M05 A2952 RMK AO2 PK WND 36027/2142 WSHFT 2118 SNB2057 P0000
cycle: 22

In Debian, you can install a package called weather-util which makes for easy searching of the data. Here’s a station at the airport in Longmont:

$ weather KLMO
Searching via station...
[caching result Vance Brand Airport, US]
Current conditions at <UNKNOWN>
Last updated Feb 16, 2019 - 04:35 PM EST / 2019.02.16 2135 UTC
   Temperature: 36.0 F (2.2 C)
   Relative Humidity: 70%
   Wind: from the E (100 degrees) at 3 MPH (3 KT)
   Sky conditions: partly cloudy

Finally, I couldn’t figure out why I was just getting the string “Updating…” instead of a temperature after swapping in KLMO for KDEN, then I realized that you also need to change the station name in the template. Here are the changes I made to my .xmobarrc while writing this post. They also include a tweak to display sky conditions and a slightly different date format.

Tuesday, February 12

reading: astounding

With the full subtitle, it’s Astounding: John W. Campbell, Isaac Asimov, Robert A. Heinlein, L. Ron Hubbard, and the Golden Age of Science Fiction, by Alec Nevala-Lee. I mentioned this one a bit over a year ago. While the author’s preoccupations and tastes aren’t always mine, his blog continued to offer up a lot of fascinating material over the last year, and the book is such an obvious fit for my interests that I both gave and received a copy of the hardcover for Christmas.

Literary and musical biographies have been a disproportionate part of my reading in adulthood, despite the genre usually leaving an unpleasant taste in my mouth. Writers, like musicians, are often difficult figures even when presented charitably, and it seems to be the rare biographer who inhabits that space between character assassination and outright hagiography. I think Nevala-Lee manages in an interesting way here, though it probably helps that I’m going in expecting to actively dislike some of these people and already have complicated feelings about the rest.

Last year in January I tried to summarize my reading for 2017 and wound up concluding:

Because really what I read in 2017, in most of the last several years, was the internet. Not even, in any real sense that registers, individual documents hosted on the network, or the work of authors I can clearly identify. Just the endless scroll.

The internet: A tide of incoherent technical documentation, error logs, seething sociopolitical rage, ideological agitation and condemnation (somewhere between authentic and engineered/rehearsed, on some spectrum it is no longer possible for me to easily parse), clickbait, reaction, comment vitriol, disinformation, machine-generated pseudojournalism, notification spam, marketing, infographical non-info, hot-take product, autoplaying video, and generalized memetic spew.

I could have written the same thing today, I think. Maybe with the difference that I’ve retreated even further from the general stream of clickbait and commentary, and post almost nowhere in public. Which in turn leads to reading less of the stuff that people post about in endless, saturated loops of indignation and competitive meta-analysis.

The general sense that the news is bad and getting worse has only grown stronger, and click-mongering hyperbole aside I think that reflects an underlying reality which is in fact pretty fucking grim. Somehow though, paying the growing hum of the looming abyss less mind has left me, bit by bit, feeling a little more able to deal with the grimness itself.

Saturday, February 2, 2019

I’m on the plane back from San Francisco. I’ve just had a Jack & Coke, which is doing bad things to both my blood sugar and my general mental acuity, but it seemed somehow appropriate to the airplane experience.

Downtown SF in 2019: A grotesque and surreal environment. Gleaming towers, all the trappings of an unfathomable wealth, the sidewalks and doorways scattered with people in the throes of debilitating addiction and untreated mental illness. You’re quickly socialized to ignore the screaming and step around the bodies and assume that someone else will attend to it if this or that figure sprawled out across the pavement is dead instead of merely unconscious.