Store probabilities as floats
This commit is contained in:
parent
12442ad084
commit
dc3e915c19
2 changed files with 13 additions and 6 deletions
|
@ -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)
|
||||
);
|
||||
|
|
|
@ -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):
|
||||
|
@ -293,9 +293,15 @@ class SPCOutlookParser():
|
|||
for poly in each_poly(self.points):
|
||||
if self.area_type == 'PROBABILISTIC':
|
||||
area = SPCOutlookProbabilityArea()
|
||||
area.hazard = self.hazard
|
||||
area.probability = self.category
|
||||
area.poly = poly
|
||||
area.hazard = self.hazard
|
||||
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':
|
||||
|
|
Loading…
Add table
Reference in a new issue