명령행에서 사용하는 weather 유틸리티

18299
points
points
플래닛 우분투에 명령행에서 사용하는 python weather 유틸리티 에 대한 글이 올라왔군요.
요약하면,
- 데비안/우분투에서는 weather-util 패키지를 설치하고, (아치리눅스는 AUR에 있는 weather 패키지)
- 명령행에서 weather, 예보를 보려면 weather -f
- 지역은 http://weather.noaa.gov/ 에서 찾아
- 예를 들어 제주국제공항은 weather -i RKPC 해서 다음의 결과를 본다는 이야기네요.
Current conditions at Korea (RKPC) Last updated Jun 04, 2008 - 05:00 AM EDT / 2008.06.04 0900 UTC Wind: from the NNE (020 degrees) at 5 MPH (4 KT) (direction variable) Sky conditions: partly cloudy Temperature: 73 F (23 C) Relative Humidity: 68%
하나를 알았으니 둘로 활용을 해 보아야죠. 저는 awesome 상태막대에 기상 상황과 온도를 표시하기 위해 다음 스크립트로 활용을 해 보았습니다.
cat ~/bin/awesome-weather
#!/bin/sh
# this script is for awesome 2.3
updateWeather() {
echo "0 widget_tell mystatusbar weather text " " `weather -i KIAH | tail -3 | head -2 | awk -F: '{print$2}' | sed ':a;$b;N;s/\n//;ba'`" | awesome-client
}
while true; do
updateWeather
sleep 300;
done
저는 나중에 참고하려 블로그에 쓰지만, 다른 분들도 다른 활용이 있으면 댓글 부탁합니다.

points
요렇게 재미난걸
요렇게 재미난걸 어디다 써먹죠...ㅎㅎ
서울은 지금...
Last updated Jun 04, 2008 - 06:00 AM EDT / 2008.06.04 1000 UTC
Wind: from the NE (040 degrees) at 7 MPH (6 KT)
Sky conditions: mostly cloudy
Temperature: 64 F (18 C)
Relative Humidity: 88%
이렇군요/..ㅎㅎ
不恥下問 - 진정으로 대화를 원하면 겸손하게 모르는 것은 모른다고 말하는 용기가 필요하다.
points
Perl로 날씨정보 가져오는 방법
Perl로 날씨정보 가져오는 방법입니다.
CPAN의 Geo::WeatherNWS 모듈 ( http://search.cpan.org/dist/Geo-WeatherNWS/ )을 설치
$cpan
cpan[1]>install Geo::WeatherNWS
.
.
.
cpan[2]>quit
$
예제코드
#!/usr/bin/perl
use strict;
use warnings;
use Geo::WeatherNWS;
my $r = Geo::WeatherNWS->new();
$r->getreporthttp('KIAH');
printf "%d F (%d C) %d%%\n", $r->{temperature_f}, $r->{temperature_c}, $r->{relative_humidity};
결과
84 F (29 C) 66%
위 모듈이 가져오는 날씨정보들은 다음과 같이 아주 다양합니다. 필요한 것을 골라 찍어서
system 함수를 통해 명령을 실행하든지 하면 다양하게 활용가능할 것 같네요.
cloudcover => "Mostly Cloudy",cloudlevel_arrayref => ["BKN030", "BKN038"],
code => "KIAH",
conditionstext => "Mostly Cloudy",
day => "04",
dewpoint_c => 22,
dewpoint_f => 71,
directory => "/data/observations/metar/stations",
error => 0,
heat_index_c => 31,
heat_index_f => 89,
http => "http://weather.noaa.gov/cgi-bin/mgetmetar.pl?cccc=KIAH",
obs => "KIAH 041453Z 19010KT 10SM BKN030 BKN038 29/22 A2980 RMK AO2 SLP088 T02940217 53005",
password => "weather\@cpan.org",
pressure_inhg => "29.80",
pressure_kgcm => "1.02904168",
pressure_lbin => "14.6363892",
pressure_mb => 1009,
pressure_mmhg => 756,
ptemerature => "T02940217",
relative_humidity => 66,
remark_arrayref => ["RMK", "AO2", "1008.8", "T02940217", 53005],
servername => "weather.noaa.gov",
slp_inhg => "29.78",
slp_kgcm => "1.028693536",
slp_lbin => "14.63143344",
slp_mb => 1008,
slp_mmhg => 756,
station_type => "Automated",
temperature_c => 29,
temperature_f => 84,
thpressure => 53005,
"time" => 1453,
username => "anonymous",
visibility_km => 16,
visibility_mi => 10,
windchill_c => 31,
windchill_f => 88,
winddir => 190,
winddirtext => "South",
windgustkts => 0,
windgustmph => 0,
windspeedkts => 10,
windspeedmph => 11,
points
펄 답글이 있을거라
펄 답글이 있을거라 예상은 했었지만 한 방에 다른 답글을 원천봉쇄 하시네요. ^^;
----
I paint objects as I think them, not as I see them.
atie's minipage
points
Kwangju ab는 경기도
Kwangju ab는 경기도 광주가 맞나요?? 아님 광주광역시가 맞나요??
------------------------
냐옹~~
points
Kwangju Air Base는
Kwangju Air Base는 광주광역시에 있군요. 혹시나 했더니 역시나... 근데 광주는 영문으로 Gwangju로 바뀌었는데... 아직도 Kwangju라고 쓰네요.

------------------------
냐옹~~
points
NOAA 위성쏜 때에 맞는
NOAA 위성쏜 때에 맞는 소프트웨어여서 그런건가..
부산도 그렇고..
대부분 군사/과학위성을 옛날에 쐈던 거라 관련 소프트웨어도 그런거겠죠..ㅎ
--------------cut here----------
너는 아느냐, 진정한 승리를
points
CurseTheWeather
CurseTheWeather
$ ctw --refresh=30 KSXX0050
부산의 날씨 예보를 30분마다 갱신하는 예입니다. weather.com에서 지역코드를 찾아볼 수 있습니다.
----
I paint objects as I think them, not as I see them.
atie's minipage