diff --git a/lib/nexrad/coord.py b/lib/nexrad/coord.py index 92e57e0..42a937b 100644 --- a/lib/nexrad/coord.py +++ b/lib/nexrad/coord.py @@ -1,4 +1,5 @@ import re +COORD_SYSTEM = 4326 class Coord(): __slots__ = 'lat', 'lon', diff --git a/lib/nexrad/station.py b/lib/nexrad/station.py index a09dbe1..d4383da 100644 --- a/lib/nexrad/station.py +++ b/lib/nexrad/station.py @@ -1,7 +1,17 @@ import csv import re -from nexrad.coord import Coord +from nexrad.coord import Coord, COORD_SYSTEM + +""" +Implements a parser and wrapper class for the WSR-88D station list +available at the following location (accessed 10 Feb 2025): + + https://apollo.nvu.vsc.edu/classes/remote/lecture_notes/radar/88d/88D_locations.html + +The input TSV file is created by copying and pasting the tabular data +from a web browser into a text file. +""" RE_PARSE = re.compile(r'^\s*(\d+)([NS]*)\s+/\s+(\d+)([EW]*)\s*$') @@ -66,9 +76,9 @@ class Station(): insert into nexrad_station ( wban, call, name, site_elevation, tower_height, coord ) values ( - ?, ?, ?, ?, ?, MakePoint(?, ?, 4326) + ?, ?, ?, ?, ?, MakePoint(?, ?, %d) ) - """ + """ % (COORD_SYSTEM) db.execute(sql, ( self.wban, self.call, self.name, diff --git a/lib/nexrad/storm.py b/lib/nexrad/storm.py index 9bdc62c..90fe362 100644 --- a/lib/nexrad/storm.py +++ b/lib/nexrad/storm.py @@ -2,7 +2,7 @@ import gzip import csv import datetime -from nexrad.coord import Coord +from nexrad.coord import Coord, COORD_SYSTEM def time_from_str(time: str): size = len(time) @@ -118,14 +118,13 @@ class StormReport(): select id, call, - ST_Distance(coord, MakePoint(?, ?, 4326), true) as distance, - ST_AsText(coord) as coord + ST_Distance(coord, MakePoint(?, ?, %d), true) as distance from nexrad_station order by distance asc limit 3 - """ + """ % (COORD_SYSTEM) st = db.execute(sql, (self.coord_start.lon, self.coord_start.lat))