[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[metar.el] NOAA resource has moved
From: |
Mark Oteiza |
Subject: |
[metar.el] NOAA resource has moved |
Date: |
Tue, 27 Sep 2016 13:51:28 -0400 |
User-agent: |
Mutt/1.7+23 (87911ba95dae) (2016-08-17) |
Hi,
The resources for weather data have moved from <http://weather.noaa.gov>
to <http://tgftp.nws.noaa.gov>. Also, nsd_bbsss.txt doesn't appear to
exist anymore, and the format of nsd_cccc.txt is apparently slightly different.
The following patch fixes the aforementioned, AFAICT
diff -u /home/mvo/downloads/metar.el /home/mvo/.emacs.d/elpa/metar-0.2/metar.el
--- /home/mvo/downloads/metar.el 2016-09-27 13:26:33.722294223 -0400
+++ /home/mvo/.emacs.d/elpa/metar-0.2/metar.el 2016-09-27 13:27:37.442802035
-0400
@@ -83,7 +83,7 @@
(const :tag "Degree Kelvin" degK)
(const :tag "Degree Fahrenheit" degF)))))
-(defcustom metar-stations-info-url "http://weather.noaa.gov/data/nsd_bbsss.txt"
+(defcustom metar-stations-info-url
"http://tgftp.nws.noaa.gov/data/nsd_cccc.txt"
"URL to use for retrieving station meta information."
:group 'metar
:type 'string)
@@ -117,23 +117,21 @@
(split-string entry ";"))
(split-string (buffer-string) "\n")))))
(setq metar-stations nil)
- (while data
- (when (and (nth 7 (car data)) (nth 8 (car data))
- (not (string= (nth 2 (car data)) "----")))
+ (dolist (entry data)
+ (when (and (nth 7 entry) (nth 8 entry)
+ (not (string= (nth 0 entry) "----")))
(setq metar-stations
(append
- (let ((item (car data)))
- (list
- (list (cons 'code (nth 2 item))
- (cons 'name (nth 3 item))
- (cons 'country (nth 5 item))
- (cons 'latitude
- (metar-station-convert-dms-to-deg (nth 7
item)))
- (cons 'longitude
- (metar-station-convert-dms-to-deg (nth 8
item)))
- (cons 'altitude (string-to-number (nth 12 item))))))
- metar-stations)))
- (setq data (cdr data)))
+ (list
+ (list (cons 'code (nth 0 entry))
+ (cons 'name (nth 3 entry))
+ (cons 'country (nth 5 entry))
+ (cons 'latitude
+ (metar-station-convert-dms-to-deg (nth 7
entry)))
+ (cons 'longitude
+ (metar-station-convert-dms-to-deg (nth 8
entry)))
+ (cons 'altitude (string-to-number (nth 11 entry)))))
+ metar-stations))))
;; (unless metar-timer
;; (setq metar-timer
;; (run-with-timer 600 nil (lambda () (setq metar-stations nil)))))
@@ -281,7 +279,7 @@
pure))))
(defcustom metar-url
- "http://weather.noaa.gov/pub/data/observations/metar/stations/%s.TXT"
+ "http://tgftp.nws.noaa.gov/data/observations/metar/stations/%s.TXT"
"URL used to fetch station specific information.
%s is replaced with the 4 letter station code."
:group 'metar
- [metar.el] NOAA resource has moved,
Mark Oteiza <=