Fully implement parsing of hydrological VTEC events
This commit is contained in:
parent
0516b2e48d
commit
1876749907
3 changed files with 46 additions and 26 deletions
|
@ -49,14 +49,17 @@ create table nexrad_afos_message (
|
||||||
timestamp_start TIMESTAMP NOT NULL,
|
timestamp_start TIMESTAMP NOT NULL,
|
||||||
timestamp_end TIMESTAMP NOT NULL,
|
timestamp_end TIMESTAMP NOT NULL,
|
||||||
serial INTEGER NOT NULL,
|
serial INTEGER NOT NULL,
|
||||||
product TEXT NOT NULL,
|
|
||||||
vtec_type TEXT NOT NULL,
|
|
||||||
actions TEXT NOT NULL,
|
|
||||||
wfo TEXT NOT NULL,
|
|
||||||
phenom TEXT NOT NULL,
|
|
||||||
sig TEXT NOT NULL,
|
|
||||||
etn INTEGER NOT NULL,
|
|
||||||
text_raw TEXT NOT NULL,
|
text_raw TEXT NOT NULL,
|
||||||
|
product TEXT NOT NULL,
|
||||||
|
wfo TEXT NOT NULL,
|
||||||
|
vtec_type TEXT,
|
||||||
|
actions TEXT,
|
||||||
|
phenom TEXT,
|
||||||
|
sig TEXT,
|
||||||
|
etn INTEGER,
|
||||||
|
hydro_severity TEXT,
|
||||||
|
hydro_cause TEXT,
|
||||||
|
hydro_record TEXT,
|
||||||
azimuth FLOAT NOT NULL,
|
azimuth FLOAT NOT NULL,
|
||||||
speed FLOAT NOT NULL,
|
speed FLOAT NOT NULL,
|
||||||
forecaster TEXT NOT NULL
|
forecaster TEXT NOT NULL
|
||||||
|
|
|
@ -5,7 +5,7 @@ import shapely
|
||||||
|
|
||||||
from nexrad.db import DatabaseTable
|
from nexrad.db import DatabaseTable
|
||||||
from nexrad.coord import COORD_SYSTEM
|
from nexrad.coord import COORD_SYSTEM
|
||||||
from nexrad.vtec import VTECEvent
|
from nexrad.vtec import VTECEvent, VTECHydroEvent
|
||||||
|
|
||||||
RE_ID = re.compile(r'^(\d+)$')
|
RE_ID = re.compile(r'^(\d+)$')
|
||||||
|
|
||||||
|
@ -123,18 +123,24 @@ class AFOSMessage(DatabaseTable):
|
||||||
timestamp_start: datetime.datetime
|
timestamp_start: datetime.datetime
|
||||||
timestamp_end: datetime.datetime
|
timestamp_end: datetime.datetime
|
||||||
|
|
||||||
product: str
|
text_raw: str
|
||||||
vtec_type: str
|
product: str
|
||||||
actions: str
|
wfo: str
|
||||||
wfo: str
|
|
||||||
phenom: str
|
vtec_type: str
|
||||||
sig: str
|
actions: str
|
||||||
etn: int
|
phenom: str
|
||||||
text_raw: str
|
sig: str
|
||||||
|
etn: int
|
||||||
|
|
||||||
|
hydro_severity: str
|
||||||
|
hydro_cause: str
|
||||||
|
hydro_record: str
|
||||||
|
|
||||||
azimuth: int
|
azimuth: int
|
||||||
speed: int
|
speed: int
|
||||||
location: shapely.Point
|
|
||||||
forecaster: str
|
forecaster: str
|
||||||
|
location: shapely.Point
|
||||||
poly: shapely.Geometry
|
poly: shapely.Geometry
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
@ -207,6 +213,15 @@ class AFOSMessageParser():
|
||||||
self.message.sig = vtec.sig
|
self.message.sig = vtec.sig
|
||||||
self.message.etn = vtec.etn
|
self.message.etn = vtec.etn
|
||||||
|
|
||||||
|
vtec = VTECHydroEvent.parse(line)
|
||||||
|
|
||||||
|
if vtec is not None:
|
||||||
|
self.message.timestamp_start = vtec.timestamp_start
|
||||||
|
self.message.timestamp_end = vtec.timestamp_end
|
||||||
|
self.message.hydro_severity = vtec.severity
|
||||||
|
self.message.hydro_cause = vtec.cause
|
||||||
|
self.message.hydro_record = vtec.record
|
||||||
|
|
||||||
def parse_serial(self, line: str):
|
def parse_serial(self, line: str):
|
||||||
match = RE_ID.match(line)
|
match = RE_ID.match(line)
|
||||||
|
|
||||||
|
|
|
@ -60,12 +60,13 @@ class VTECEventType(enum.StrEnum):
|
||||||
EXPERIMENTAL_VTEC = 'X'
|
EXPERIMENTAL_VTEC = 'X'
|
||||||
|
|
||||||
class VTECEvent():
|
class VTECEvent():
|
||||||
typeof: str
|
typeof: str
|
||||||
actions: str
|
actions: str
|
||||||
wfo: str
|
wfo: str
|
||||||
phenom: str
|
phenom: str
|
||||||
sig: str
|
sig: str
|
||||||
etn: int
|
etn: int
|
||||||
|
|
||||||
timestamp_start: datetime.datetime
|
timestamp_start: datetime.datetime
|
||||||
timestamp_end: datetime.datetime
|
timestamp_end: datetime.datetime
|
||||||
|
|
||||||
|
@ -94,9 +95,10 @@ class VTECHydroEvent():
|
||||||
'severity', 'cause', 'record', 'timestamp_start', 'timestamp_end'
|
'severity', 'cause', 'record', 'timestamp_start', 'timestamp_end'
|
||||||
)
|
)
|
||||||
|
|
||||||
severity: str
|
severity: str
|
||||||
cause: str
|
cause: str
|
||||||
record: str
|
record: str
|
||||||
|
|
||||||
timestamp_start: datetime.datetime
|
timestamp_start: datetime.datetime
|
||||||
timestamp_end: datetime.datetime
|
timestamp_end: datetime.datetime
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue