Declare, use COORD_SYSTEM as 4326
This commit is contained in:
parent
68f83b72d2
commit
a93e91c1ee
3 changed files with 17 additions and 7 deletions
|
@ -1,4 +1,5 @@
|
||||||
import re
|
import re
|
||||||
|
COORD_SYSTEM = 4326
|
||||||
|
|
||||||
class Coord():
|
class Coord():
|
||||||
__slots__ = 'lat', 'lon',
|
__slots__ = 'lat', 'lon',
|
||||||
|
|
|
@ -1,7 +1,17 @@
|
||||||
import csv
|
import csv
|
||||||
import re
|
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*$')
|
RE_PARSE = re.compile(r'^\s*(\d+)([NS]*)\s+/\s+(\d+)([EW]*)\s*$')
|
||||||
|
|
||||||
|
@ -66,9 +76,9 @@ class Station():
|
||||||
insert into nexrad_station (
|
insert into nexrad_station (
|
||||||
wban, call, name, site_elevation, tower_height, coord
|
wban, call, name, site_elevation, tower_height, coord
|
||||||
) values (
|
) values (
|
||||||
?, ?, ?, ?, ?, MakePoint(?, ?, 4326)
|
?, ?, ?, ?, ?, MakePoint(?, ?, %d)
|
||||||
)
|
)
|
||||||
"""
|
""" % (COORD_SYSTEM)
|
||||||
|
|
||||||
db.execute(sql, (
|
db.execute(sql, (
|
||||||
self.wban, self.call, self.name,
|
self.wban, self.call, self.name,
|
||||||
|
|
|
@ -2,7 +2,7 @@ import gzip
|
||||||
import csv
|
import csv
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
from nexrad.coord import Coord
|
from nexrad.coord import Coord, COORD_SYSTEM
|
||||||
|
|
||||||
def time_from_str(time: str):
|
def time_from_str(time: str):
|
||||||
size = len(time)
|
size = len(time)
|
||||||
|
@ -118,14 +118,13 @@ class StormReport():
|
||||||
select
|
select
|
||||||
id,
|
id,
|
||||||
call,
|
call,
|
||||||
ST_Distance(coord, MakePoint(?, ?, 4326), true) as distance,
|
ST_Distance(coord, MakePoint(?, ?, %d), true) as distance
|
||||||
ST_AsText(coord) as coord
|
|
||||||
from
|
from
|
||||||
nexrad_station
|
nexrad_station
|
||||||
order by
|
order by
|
||||||
distance asc
|
distance asc
|
||||||
limit 3
|
limit 3
|
||||||
"""
|
""" % (COORD_SYSTEM)
|
||||||
|
|
||||||
st = db.execute(sql, (self.coord_start.lon,
|
st = db.execute(sql, (self.coord_start.lon,
|
||||||
self.coord_start.lat))
|
self.coord_start.lat))
|
||||||
|
|
Loading…
Add table
Reference in a new issue