unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Mark Oteiza <mvoteiza@udel.edu>
To: emacs-devel@gnu.org
Cc: Mario Lang <mlang@delysid.org>
Subject: [metar.el] NOAA resource has moved
Date: Tue, 27 Sep 2016 13:51:28 -0400	[thread overview]
Message-ID: <20160927175128.GA14560@holos.localdomain> (raw)

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



             reply	other threads:[~2016-09-27 17:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-27 17:51 Mark Oteiza [this message]
2016-09-27 23:12 ` [metar.el] NOAA resource has moved Mario Lang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160927175128.GA14560@holos.localdomain \
    --to=mvoteiza@udel.edu \
    --cc=emacs-devel@gnu.org \
    --cc=mlang@delysid.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).