Live data from Hacker News

Weatherme CLI Tool

github.com

21–30 of 30 posts

Re: Weatherme CLI Tool

#21
post #12

I suppose this is as good a time as any to plug noaa, a CLI tool that can give you the current conditions and forecast, but also allows you to retrieve any product the US National Weather Service produces. It’s way geekier than the above, but perhaps more useful for some. https://github.com/sramsay/nowa/ (I am also the author of wu, which was a popular cli tool for the Weather Underground API. I had to discontinue th…

Thank you for wu and this too, Please enlighten me on why nowa is written in C, would you?

The usual reasons, I suppose (speed, portability, ubiquity . . .) Do you mean as opposed to Go?

Re: Weatherme CLI Tool

#22
Using curl, jq and api.weather.gov. See docs for more info. Use Google Maps or equivalent to get lat long.

  # Set this:
 
  latlong='33.7737,-118.1365'

  url=$(curl -sS "https://api.weather.gov/points/$latlong" | jq -r '.properties.forecastHourly')
  curl -sS "$url" | jq -r '.properties | .periods[0].temperature, .generatedAt'

Using Python.

  import requests
  
  # Set this:
  latlong = '33.7737,-118.1365'
  
  session = requests.Session()
  
  url = session.get('https://api.weather.gov/points/' + latlong).json()['properties']['forecastHourly']
  f = session.get(url).json()['properties']
  print(f['periods'][0]['temperature'])
  print(f['generatedAt'])

Re: Weatherme CLI Tool

#24
post #12

I suppose this is as good a time as any to plug noaa, a CLI tool that can give you the current conditions and forecast, but also allows you to retrieve any product the US National Weather Service produces. It’s way geekier than the above, but perhaps more useful for some. https://github.com/sramsay/nowa/ (I am also the author of wu, which was a popular cli tool for the Weather Underground API. I had to discontinue th…

Thank you for wu and this too, Please enlighten me on why nowa is written in C, would you?

As always, you should feel free to rewrite in whatever Better Language™ you prefer.

Re: Weatherme CLI Tool

#28
post #23

Reminds me of `curl wttr.in` -- although slightly more verbose in some metrics.

I had the same thought; this is in my shell RC: alias weather='f() { curl wttr.in/${1:-sydney} };f'

         echo yourcity | nc graph.no 79
or

         finger yourcity@graph.no

Re: Weatherme CLI Tool

#29
post #23

Reminds me of `curl wttr.in` -- although slightly more verbose in some metrics.

I had the same thought; this is in my shell RC: alias weather='f() { curl wttr.in/${1:-sydney} };f'

Interesting -- why do you define an alias that defines and then immediately calls a function instead of just defining `weather` as the function itself?
Post reply on HN