diff --git a/db/nexrad.sql b/db/nexrad.sql index 79ea1b2..b117b50 100644 --- a/db/nexrad.sql +++ b/db/nexrad.sql @@ -1,6 +1,6 @@ begin transaction; -create table nexrad_station ( +create table nexrad_radar ( id INTEGER PRIMARY KEY NOT NULL, wban INTEGER, call TEXT NOT NULL, @@ -10,7 +10,7 @@ create table nexrad_station ( ); select AddGeometryColumn( - 'nexrad_station', 'coord', 4326, 'POINT', 'XY' + 'nexrad_radar', 'coord', 4326, 'POINT', 'XY' ); commit; diff --git a/lib/nexrad/station.py b/lib/nexrad/radar.py similarity index 78% rename from lib/nexrad/station.py rename to lib/nexrad/radar.py index e50a029..037a9fe 100644 --- a/lib/nexrad/station.py +++ b/lib/nexrad/radar.py @@ -4,7 +4,7 @@ import re from nexrad.coord import Coord, COORD_SYSTEM """ -Implements a parser and wrapper class for the WSR-88D station list +Implements a parser and wrapper class for the WSR-88D radar list available at the following location (accessed 10 Feb 2025): https://apollo.nvu.vsc.edu/classes/remote/lecture_notes/radar/88d/88D_locations.html @@ -38,7 +38,7 @@ def parse(text: str): return Coord(sign_lat * lat, sign_lon * lon) -class Station(): +class Radar(): __slots__ = 'wban', 'call', 'name', 'coord', 'site_elevation', 'tower_height', wban: int @@ -50,15 +50,15 @@ class Station(): @staticmethod def from_tsv_row(row: list): - station = Station() - station.wban = int(row[0]) if row[0] != 'PENDING' else None - station.call = row[1] - station.name = row[2] - station.coord = parse(row[3]) - station.site_elevation = 0.3048 * float(row[4]) - station.tower_height = float(row[5]) + radar = Radar() + radar.wban = int(row[0]) if row[0] != 'PENDING' else None + radar.call = row[1] + radar.name = row[2] + radar.coord = parse(row[3]) + radar.site_elevation = 0.3048 * float(row[4]) + radar.tower_height = float(row[5]) - return station + return radar @staticmethod def each_from_tsv(file: str): @@ -69,11 +69,11 @@ class Station(): for i in range(0, len(row)): row[i] = row[i].rstrip() - yield Station.from_tsv_row(row) + yield Radar.from_tsv_row(row) def add_to_db(self, db): sql = """ - insert into nexrad_station ( + insert into nexrad_radar ( wban, call, name, site_elevation, tower_height, coord ) values ( ?, ?, ?, ?, ?, MakePoint(?, ?, %d) diff --git a/lib/nexrad/storm.py b/lib/nexrad/storm.py index 2dd34b0..dfa56e3 100644 --- a/lib/nexrad/storm.py +++ b/lib/nexrad/storm.py @@ -113,14 +113,14 @@ class StormReport(): def is_radar_significant(self): return self.event_type in self.RADAR_SIGNIFICANT_EVENT_TYPES - def nearest_station(self, db): + def nearest_radars(self, db): sql = """ select id, call, ST_Distance(coord, MakePoint(?, ?, %d), true) as distance from - nexrad_station + nexrad_radar where distance <= 460000 order by