unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [metar.el] NOAA resource has moved
@ 2016-09-27 17:51 Mark Oteiza
  2016-09-27 23:12 ` Mario Lang
  0 siblings, 1 reply; 2+ messages in thread
From: Mark Oteiza @ 2016-09-27 17:51 UTC (permalink / raw)
  To: emacs-devel; +Cc: Mario Lang

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



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [metar.el] NOAA resource has moved
  2016-09-27 17:51 [metar.el] NOAA resource has moved Mark Oteiza
@ 2016-09-27 23:12 ` Mario Lang
  0 siblings, 0 replies; 2+ messages in thread
From: Mario Lang @ 2016-09-27 23:12 UTC (permalink / raw)
  To: Mark Oteiza; +Cc: emacs-devel

Mark Oteiza <mvoteiza@udel.edu> writes:

> 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

Thank you!

-- 
CYa,
  ⡍⠁⠗⠊⠕



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-09-27 23:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-27 17:51 [metar.el] NOAA resource has moved Mark Oteiza
2016-09-27 23:12 ` Mario Lang

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).