changeset 4356:5356fd2ea3f6

Identify: legend shows reference values from Nash Sutcliffe
author Thomas Junk <thomas.junk@intevation.de>
date Mon, 09 Sep 2019 15:54:48 +0200
parents 6365466ead83
children e8af2ed8666e
files client/src/components/identify/Identify.vue
diffstat 1 files changed, 27 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/identify/Identify.vue	Mon Sep 09 14:43:49 2019 +0200
+++ b/client/src/components/identify/Identify.vue	Mon Sep 09 15:54:48 2019 +0200
@@ -241,7 +241,9 @@
   data() {
     return {
       refGaugeStatus: "",
-      gaugeStatus: ""
+      gaugeStatus: "",
+      gaugeCoeffs: null,
+      refGaugeCoeffs: null
     };
   },
   computed: {
@@ -262,10 +264,17 @@
     gaugeStatusText() {
       const nsc24 = this.config.gm_forecast_vs_reality_nsc_24h;
       const nsc72 = this.config.gm_forecast_vs_reality_nsc_72h;
+      const coeffWarn = this.gaugeCoeffs ? this.gaugeCoeffs[2].value : "";
+      const coeffDanger = this.gaugeCoeffs ? this.gaugeCoeffs[0].value : "";
       const messagesPerState = {
-        OK: this.$gettext("Nash-Sutcliffe") + `>${nsc24} /24h >${nsc72} / 72h`,
-        WARNING: this.$gettext("Nash-Sutcliffe") + ` < ${nsc72} / 72h`,
-        DANGER: this.$gettext("Nash-Sutcliffe") + ` < ${nsc24} / 72h`,
+        OK:
+          this.$gettext("Nash-Sutcliffe") +
+          `(${coeffDanger} >${nsc24} /24h ${coeffWarn} >${nsc72} / 72h)`,
+        WARNING:
+          this.$gettext("Nash-Sutcliffe") + ` (${coeffWarn} < ${nsc72} / 72h)`,
+        DANGER:
+          this.$gettext("Nash-Sutcliffe") +
+          ` (${coeffDanger} < ${nsc24} / 72h)`,
         NEUTRAL: this.$gettext("Nash-Sutcliffe not available")
       };
       return messagesPerState[this.gaugeStatus];
@@ -276,10 +285,19 @@
     refGaugeStatusText() {
       const nsc24 = this.config.gm_forecast_vs_reality_nsc_24h;
       const nsc72 = this.config.gm_forecast_vs_reality_nsc_72h;
+      const coeffWarn = this.refGaugeCoeffs ? this.refGaugeCoeffs[2].value : "";
+      const coeffDanger = this.refGaugeCoeffs
+        ? this.refGaugeCoeffs[0].value
+        : "";
       const messagesPerState = {
-        OK: this.$gettext("Nash-Sutcliffe") + `>${nsc24} /24h >${nsc72} / 72h`,
-        WARNING: this.$gettext("Nash-Sutcliffe") + ` < ${nsc72} / 72h`,
-        DANGER: this.$gettext("Nash-Sutcliffe") + ` < ${nsc24} / 72h`,
+        OK:
+          this.$gettext("Nash-Sutcliffe") +
+          `(${coeffDanger} >${nsc24} /24h ${coeffWarn} >${nsc72} / 72h)`,
+        WARNING:
+          this.$gettext("Nash-Sutcliffe") + ` (${coeffWarn} < ${nsc72} / 72h)`,
+        DANGER:
+          this.$gettext("Nash-Sutcliffe") +
+          ` (${coeffDanger} < ${nsc24} / 72h)`,
         NEUTRAL: this.$gettext("Nash-Sutcliffe not available")
       };
       return messagesPerState[this.refGaugeStatus];
@@ -298,6 +316,7 @@
         this.$store
           .dispatch("gauges/getNashSutcliffeForISRS", isrs)
           .then(response => {
+            this.gaugeCoeffs = response.coeffs;
             this.gaugeStatus = classifications.calcForecastVsRealityForNSC(
               response
             );
@@ -311,6 +330,7 @@
         this.$store
           .dispatch("gauges/getNashSutcliffeForISRS", isrs)
           .then(response => {
+            this.refGaugeCoeffs = response.coeffs;
             this.refGaugeStatus = classifications.calcForecastVsRealityForNSC(
               response
             );