aboutsummaryrefslogtreecommitdiff
path: root/content/posts/2019-08-25-weather-sage.md
blob: 1153bd6bea8b48d0c0ded2451a8ea2355d77ed48 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
---
date: "2019-08-25T22:00:00Z"
title: Weather Sage 0.1.2 Released
---

A couple days ago I released [Weather Sage][] 0.1.2.

[Weather Sage][] is a command-line tool and [Ruby][] library to get the
weather forecast and current weather observations for a domestic United
States street address.

It uses the [Census Bureau Geocoding API][census-api] to geocode street
addresses, and the [National Weather Service Weather API][weather-api]
to get weather forecasts and current weather observations.

The command-line tool queries the [APIs][] above to obtain the requested
information for the given street address, and then prints the results to
standard output in [CSV][] format.

Here's an example of using the `weather-sage` command-line tool to get
the weather forecast for the address `1600 pennsylvania ave nw,
washington dc`:

```
> weather-sage forecast '1600 pennsylvania ave nw washington dc'
address,name,temperature,temperature_unit,wind_speed,wind_direction,short_forecast
1600 pennsylvania ave washington dc,Today,97,F,7 mph,SW,Scattered Showers And Thunderstorms
1600 pennsylvania ave washington dc,Tonight,76,F,2 to 7 mph,SW,Scattered Showers And Thunderstorms then Mostly Cloudy
1600 pennsylvania ave washington dc,Tuesday,94,F,6 mph,E,Slight Chance Rain Showers then Chance Showers And Thunderstorms
1600 pennsylvania ave washington dc,Tuesday Night,75,F,2 to 6 mph,S,Chance Showers And Thunderstorms
1600 pennsylvania ave washington dc,Wednesday,94,F,3 to 9 mph,SW,Chance Showers And Thunderstorms
1600 pennsylvania ave washington dc,Wednesday Night,76,F,5 to 8 mph,SW,Chance Showers And Thunderstorms
...
```

And here's an example of using the `weather-sage` command-line tool to
get the current weather observations from the weather station closest to
the address `1600 pennsylvania ave nw, washington dc`:

```
> weather-sage now '1600 pennsylvania ave washington dc'
address,name,type,value,unit,quality_control
1600 pennsylvania ave washington dc,timestamp,time,2019-08-19T06:52:00+00:00
1600 pennsylvania ave washington dc,textDescription,text,Mostly Cloudy
1600 pennsylvania ave washington dc,temperature,value,26.700000000000045,unit:degC,qc:V
1600 pennsylvania ave washington dc,relativeHumidity,value,81.65039907186703,unit:percent,qc:C
...
```

You can install [Weather Sage][] via [RubyGems][] like this:

```
# install weather-sage with rubygems
> gem install weather-sage
```

**Note:** This is the initial release, so the API documentation, test
suite, and command-line interface are not yet complete.

  [weather sage]: https://github.com/pablotron/weather-sage "Weather Sage"
  [apis]: https://en.wikipedia.org/wiki/Application_programming_interface "Application Programming Interface"
  [csv]: https://en.wikipedia.org/wiki/Comma-separated_values "Comma-separated Value format"
  [ruby]: https://ruby-lang.org/ "Ruby programming language"
  [rubygems]: https://rubygems.org/ "Ruby package manager"
  [weather-api]: https://api.weather.gov/ "national Weather Service (NWS) Weather API"
  [census-api]: https://geocoding.geo.census.gov/geocoder/ "Census Bureau Geocoding API"