diff --git a/db/xmet.sql b/db/xmet.sql index fabb43f..c90638f 100644 --- a/db/xmet.sql +++ b/db/xmet.sql @@ -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) ); diff --git a/lib/xmet/spc.py b/lib/xmet/spc.py index 4c2119c..fd6f23e 100644 --- a/lib/xmet/spc.py +++ b/lib/xmet/spc.py @@ -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':