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_end TIMESTAMP 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,
|
||||
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,
|
||||
speed FLOAT NOT NULL,
|
||||
forecaster TEXT NOT NULL
|
||||
|
|
|
@ -5,7 +5,7 @@ import shapely
|
|||
|
||||
from nexrad.db import DatabaseTable
|
||||
from nexrad.coord import COORD_SYSTEM
|
||||
from nexrad.vtec import VTECEvent
|
||||
from nexrad.vtec import VTECEvent, VTECHydroEvent
|
||||
|
||||
RE_ID = re.compile(r'^(\d+)$')
|
||||
|
||||
|
@ -123,18 +123,24 @@ class AFOSMessage(DatabaseTable):
|
|||
timestamp_start: datetime.datetime
|
||||
timestamp_end: datetime.datetime
|
||||
|
||||
product: str
|
||||
vtec_type: str
|
||||
actions: str
|
||||
wfo: str
|
||||
phenom: str
|
||||
sig: str
|
||||
etn: int
|
||||
text_raw: str
|
||||
text_raw: str
|
||||
product: str
|
||||
wfo: str
|
||||
|
||||
vtec_type: str
|
||||
actions: str
|
||||
phenom: str
|
||||
sig: str
|
||||
etn: int
|
||||
|
||||
hydro_severity: str
|
||||
hydro_cause: str
|
||||
hydro_record: str
|
||||
|
||||
azimuth: int
|
||||
speed: int
|
||||
location: shapely.Point
|
||||
forecaster: str
|
||||
location: shapely.Point
|
||||
poly: shapely.Geometry
|
||||
|
||||
def __init__(self):
|
||||
|
@ -207,6 +213,15 @@ class AFOSMessageParser():
|
|||
self.message.sig = vtec.sig
|
||||
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):
|
||||
match = RE_ID.match(line)
|
||||
|
||||
|
|
|
@ -60,12 +60,13 @@ class VTECEventType(enum.StrEnum):
|
|||
EXPERIMENTAL_VTEC = 'X'
|
||||
|
||||
class VTECEvent():
|
||||
typeof: str
|
||||
actions: str
|
||||
wfo: str
|
||||
phenom: str
|
||||
sig: str
|
||||
etn: int
|
||||
typeof: str
|
||||
actions: str
|
||||
wfo: str
|
||||
phenom: str
|
||||
sig: str
|
||||
etn: int
|
||||
|
||||
timestamp_start: datetime.datetime
|
||||
timestamp_end: datetime.datetime
|
||||
|
||||
|
@ -94,9 +95,10 @@ class VTECHydroEvent():
|
|||
'severity', 'cause', 'record', 'timestamp_start', 'timestamp_end'
|
||||
)
|
||||
|
||||
severity: str
|
||||
cause: str
|
||||
record: str
|
||||
severity: str
|
||||
cause: str
|
||||
record: str
|
||||
|
||||
timestamp_start: datetime.datetime
|
||||
timestamp_end: datetime.datetime
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue