diff --git a/mlair/plotting/postprocessing_plotting.py b/mlair/plotting/postprocessing_plotting.py index 3f11f52c866483b592b6ffcc53becd1b6b2caf4e..4ca6412c78ec211793e2fe44052762031c26c41e 100644 --- a/mlair/plotting/postprocessing_plotting.py +++ b/mlair/plotting/postprocessing_plotting.py @@ -33,7 +33,8 @@ class PlotContingency(AbstractPlotClass): def __init__(self, station_names, file_path, comp_path, file_name, plot_folder: str = ".", model_name: str = "nn", model_plot_name: str = "nn", obs_name: str = "obs", comp_names: str = "IntelliO3", - plot_names=["contingency_threat_score", "contingency_hit_rate", "contingency_false_alarm_rate", + plot_names=["contingency_gilbert_skill_score", "contingency_threat_score", "contingency_hit_rate", + "contingency_false_alarm_rate", "contingency_bias", "contingency_all_scores", "contingency_table"]): super().__init__(plot_folder, plot_names[0]) @@ -50,10 +51,12 @@ class PlotContingency(AbstractPlotClass): self._plot_names = plot_names self._min_threshold, self._max_threshold = self._min_max_threshold() contingency_array = self._calculate_contingencies() - self._scores = ["ts", "h", "f", "b"] + self._scores = ["gss", "ts", "h", "f", "b"] score_array = self._calculate_all_scores(contingency_array) self._plot_counter = 0 + self._plot(score_array, "gss") + self._save() self._plot(score_array, "ts") self._save() self._plot(score_array, "h") @@ -213,6 +216,14 @@ class PlotContingency(AbstractPlotClass): false_above = contingency[1] false_below = contingency[2] true_below = contingency[3] + if score == "gss": + frequency_above_threshold = (true_above + false_below)/(true_above + false_above + false_below + true_below) + forecasts_above_threshold = true_above + false_above + chance_hits = frequency_above_threshold*forecasts_above_threshold + if (true_above + false_above + false_below - chance_hits) == 0: + score_value = 1 + else: + score_value = (true_above - chance_hits)/(true_above + false_above + false_below - chance_hits) if score == "ts": if (true_above + false_above + false_below) == 0: score_value = 1