nowa

Crates.ionowa
lib.rsnowa
version1.1.1
sourcesrc
created_at2024-05-14 20:28:45.605125
updated_at2024-05-19 23:17:31.12863
descriptionA small, fast command-line application that retrieves weather data from the United States National Weather Service
homepage
repositoryhttps://git.sr.ht/~sramsay/nowa
max_upload_size
id1240175
size113,486
Stephen Ramsay (sramsay)

documentation

README

builds.sr.ht status License: GPL v3

nowa

Version 1.1.1

nowa is a small, fast command-line application that retrieves weather data from the United States National Weather Service.

Quickstart

[See notes on building and installing nowa below]

First, figure out the coordinates of the place for which you'd like to see weather information (there are lots of tools on the web for doing this). Once you have this, you can ask nowa to list nearby weather stations:

$ nowa --list-stations 65.846004,-150.725719

Available Weather Stations for 65.846,-150.725719
ID    Location
----  --------
PATA: Tanana, Calhoun Memorial Airport
PABT: Bettles, Bettles Airport
PAIM: Utopia Creek, Indian Mountain LRRS Airport
PANN: Nenana Municipal Airport
PAFA: Fairbanks, Fairbanks International Airport
PAMH: Minchumina, Minchumina Airport
PAIN: McKinley Park, McKinley National Park Airport
PFYU: Fort Yukon, Fort Yukon Airport
[...]

Now, that's the middle of the Yukon-Koyukuk Census Area in Alaska—one of the least populated places in the country. Nonetheless, there are over a hundred stations in the region.

Let's look at the Elfin Cove Seaplane Base. We can use its station id (PAEL) to ask what products the NWS API offers:

$ nowa --list-products --station-id PAEL

Forecast Office Products Available for PAEL:

Code  Description
----  -----------
AFD   Area Forecast Discussion
CAP   Common Alerting Protocol
CLM   Climatological Report (Monthly)
CWF   Coastal Waters Forecast
FWF   Routine Fire Wx Fcst (With/Without 6-10 Day Outlook)
HML   AHPS XML
NOW   Short Term Forecast
OFF   Offshore Forecast
PFM   Point Forecast Matrices
RER   Record Report
RR3   Hydro-Met Data Report Part 3
RRS   HADS Data
[...]

(Note the -i/--station-id switch. That's required for a lot of operations with nowa)

That station has lots of data products, including an Offshore Waters Forecast (OFF). So let's grab that:

$ nowa --product OFF -i PAEL

Offshore Forecast
000
FZAK67 PAJK 021145
OFFAJK

Offshore Waters Forecast
National Weather Service Juneau AK
345 AM AKDT Wed Jun 2 2021

Offshore waters forecast for Gulf of Alaska east of 144W

Wind forecasts reflect the predominant speed and direction
expected. Sea forecasts represent the average of the highest
one-third of the combined windwave and swell height.
[...]

Building and Installing nowa

nowa is written in Rust, and so requires a Rust compiler installed on your machine.

Assuming you have that taken care of, it'll be something like this:

$ cargo install nowa

Exactly where that installs the binary depends on your local configuration, but cargo is pretty clever, and can probably put it anywhere you like.

Usage

nowa is capable of displaying any data product made available through the NWS API. If you know the id of a station in a particular area, know the data product you are interested in displaying, and that data product is available at that station, nowa can display it. And all of this information (save the lat/long of the location you're interested in) can be determined using nowa itself.

But nowa also provides a number of convenience options for commonly requested (and mostly universal) information, including current conditions, 7-day forecast, active alerts, and scientific forecast discussions. So if you'd simply like to see the current conditions in my hometown (Lincoln, NE):

$ nowa --conditions -i KLNK

This will give you nicely-formatted output:

Current conditions at Lincoln, Lincoln Municipal Airport (KLNK)
40° 49' 52" N, -96° 45' 52" W
	 Summary: Clear
	 Temperature: 32.0°F
	 Dewpoint: 15.1°F (dry)
	 Relative Humidity: 0.0%
	 Wind: From the S (180°) at 5.8 mph
	 Pressure: 1022.4 mb
	 Visibility: 8.0 mi

as will a request for the seven-day forecast:

$ nowa --forecast -i KLNK

To see if there are any active alerts:

$ nowa --alerts -i KLNK

And to completely geek out (with the "scientific forecast discussion"):

$ nowa --discussion -i KLNK

Once you know what products are available at a station, it's easy to set up aliases for particular products like the hazardous weather outlook (HWO), air quality report (AQI), yesterday's precipitation totals (CLI), and so forth.

Also: It's possible to display any NWS product as raw JSON by adding the --json switch. For example:

$ nowa --json --conditions -i KLNK

This is more useful than it might seem, because getting useful information out of the API typically involves following several embedded links; nowa does all this for you. And, of course, once you have the "raw" JSON, you can send it along a pipeline, import it into another tool, etc.

License

nowa is written and maintained by Stephen Ramsay (sramsay{at}protonmail{dot}com).

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

NOAA/NWS data is in the public domain. However, users of NOAA/NWS data should be familiar with the terms and conditions set forth in their disclaimer.

nowa is neither endorsed by, nor in any way affiliated with, either the National Oceanic and Atmospheric Administration or the National Weather Service.

Last Modified: 2024-05-19T18:16:53:-0500

Commit count: 0

cargo fmt