[cig-commits] r11861 - cs/portal/trunk/seismo/SeismoWebPortal
leif at geodynamics.org
leif at geodynamics.org
Wed Apr 23 17:24:46 PDT 2008
Author: leif
Date: 2008-04-23 17:24:45 -0700 (Wed, 23 Apr 2008)
New Revision: 11861
Modified:
cs/portal/trunk/seismo/SeismoWebPortal/views.py
Log:
Gracefully accept station lists in the old v3.5 format (with the
station count as the first line).
Modified: cs/portal/trunk/seismo/SeismoWebPortal/views.py
===================================================================
--- cs/portal/trunk/seismo/SeismoWebPortal/views.py 2008-04-24 00:02:35 UTC (rev 11860)
+++ cs/portal/trunk/seismo/SeismoWebPortal/views.py 2008-04-24 00:24:45 UTC (rev 11861)
@@ -2019,10 +2019,18 @@
def parse_station_list(stationList, stream):
- for line in stream:
+ for i, line in enumerate(stream):
# parse the line
- code, network, latitude, longitude, elevation, bur = line.split()
+ line = line.split()
+ if i == 0 and len(line) == 1:
+ # old-style station list with count
+ continue
+
+ if len(line) != 6:
+ raise Exception
+
+ code, network, latitude, longitude, elevation, bur = line
latitude, longitude = float(latitude), float(longitude)
elevation, bur = float(elevation), float(bur)
More information about the cig-commits
mailing list