Store probabilities as floats

This commit is contained in:
XANTRONIX 2025-03-16 01:45:55 -04:00
parent 12442ad084
commit dc3e915c19
2 changed files with 13 additions and 6 deletions

View file

@ -154,7 +154,8 @@ create table xmet_spc_outlook_probability_area (
id INTEGER PRIMARY KEY NOT NULL,
outlook_id INTEGER NOT NULL,
hazard TEXT NOT NULL,
probability INTEGER NOT NULL,
probability FLOAT,
sig BOOLEAN NOT NULL DEFAULT FALSE,
FOREIGN KEY (outlook_id) REFERENCES xmet_spc_outlook (id)
);

View file

@ -112,14 +112,14 @@ class SPCOutlookArea(DatabaseTable):
class SPCOutlookProbabilityArea(SPCOutlookArea):
__slots__ = (
'hazard', 'probability',
'hazard', 'probability', 'sig',
)
__table__ = 'xmet_spc_outlook_probability_area'
__key__ = 'id'
__columns__ = (
'id', 'outlook_id', 'hazard', 'probability', 'poly'
'id', 'outlook_id', 'hazard', 'probability', 'sig', 'poly'
)
class SPCOutlookCategoryArea(SPCOutlookArea):
@ -294,9 +294,15 @@ class SPCOutlookParser():
if self.area_type == 'PROBABILISTIC':
area = SPCOutlookProbabilityArea()
area.hazard = self.hazard
area.probability = self.category
area.poly = poly
if self.category == 'SIGN':
area.probability = None
area.sig = True
else:
area.probability = float(self.category)
area.sig = False
self.outlook.probabilities.append(area)
elif self.area_type == 'CATEGORICAL':
area = SPCOutlookCategoryArea()