s/station/radar/g
This commit is contained in:
parent
420456f028
commit
12ead19918
3 changed files with 16 additions and 16 deletions
|
@ -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;
|
||||
|
|
|
@ -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)
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue