Correlation building fixes
[weather.git] / weather.py
index cd22db3..2bacc27 100644 (file)
@@ -1,7 +1,7 @@
 """Contains various object definitions needed by the weather utility."""
 
 weather_copyright = """\
-# Copyright (c) 2006-2012 Jeremy Stanley <fungi@yuggoth.org>. Permission to
+# Copyright (c) 2006-2014 Jeremy Stanley <fungi@yuggoth.org>. Permission to
 # use, copy, modify, and distribute this software is granted under terms
 # provided in the LICENSE file distributed with this software.
 #"""
@@ -1226,7 +1226,7 @@ def correlate():
 %s
 # generated by %s on %s from these public domain sources:
 #
-# http://www.census.gov/geo/www/gazetteer/gazetteer2010.html
+# http://www.census.gov/geo/maps-data/data/gazetteer2010.html
 # %s %s %s
 # %s %s %s
 # %s %s %s
@@ -1545,12 +1545,12 @@ def correlate():
     cpfz = {}
     cpfzcf = open(cpfzcf_fn)
     for line in cpfzcf:
-        fields = line.split("|")
+        fields = line.strip().split("|")
         if len(fields) == 11 \
             and fields[0] and fields[1] and fields[9] and fields[10]:
             zone = "z".join( fields[:2] ).lower()
             if zone in zones:
-                zones[zone]["centroid"] = gecos( ",".join( fields[9:] ) )
+                zones[zone]["centroid"] = gecos( ",".join( fields[9:11] ) )
             elif fields[6]:
                 state = fields[0]
                 description = fields[3]