Mercurial > gemma
comparison client/src/components/identify/Identify.vue @ 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 | e4e32c77ed83 |
children | 9842812b92e0 |
comparison
equal
deleted
inserted
replaced
4352:6365466ead83 | 4356:5356fd2ea3f6 |
---|---|
239 export default { | 239 export default { |
240 name: "identify", | 240 name: "identify", |
241 data() { | 241 data() { |
242 return { | 242 return { |
243 refGaugeStatus: "", | 243 refGaugeStatus: "", |
244 gaugeStatus: "" | 244 gaugeStatus: "", |
245 gaugeCoeffs: null, | |
246 refGaugeCoeffs: null | |
245 }; | 247 }; |
246 }, | 248 }, |
247 computed: { | 249 computed: { |
248 ...mapGetters("application", ["versionStr"]), | 250 ...mapGetters("application", ["versionStr"]), |
249 ...mapState("application", ["showIdentify", "userManualUrl", "config"]), | 251 ...mapState("application", ["showIdentify", "userManualUrl", "config"]), |
260 return forecastVsRealityColorCodes[this.gaugeStatus]; | 262 return forecastVsRealityColorCodes[this.gaugeStatus]; |
261 }, | 263 }, |
262 gaugeStatusText() { | 264 gaugeStatusText() { |
263 const nsc24 = this.config.gm_forecast_vs_reality_nsc_24h; | 265 const nsc24 = this.config.gm_forecast_vs_reality_nsc_24h; |
264 const nsc72 = this.config.gm_forecast_vs_reality_nsc_72h; | 266 const nsc72 = this.config.gm_forecast_vs_reality_nsc_72h; |
267 const coeffWarn = this.gaugeCoeffs ? this.gaugeCoeffs[2].value : ""; | |
268 const coeffDanger = this.gaugeCoeffs ? this.gaugeCoeffs[0].value : ""; | |
265 const messagesPerState = { | 269 const messagesPerState = { |
266 OK: this.$gettext("Nash-Sutcliffe") + `>${nsc24} /24h >${nsc72} / 72h`, | 270 OK: |
267 WARNING: this.$gettext("Nash-Sutcliffe") + ` < ${nsc72} / 72h`, | 271 this.$gettext("Nash-Sutcliffe") + |
268 DANGER: this.$gettext("Nash-Sutcliffe") + ` < ${nsc24} / 72h`, | 272 `(${coeffDanger} >${nsc24} /24h ${coeffWarn} >${nsc72} / 72h)`, |
273 WARNING: | |
274 this.$gettext("Nash-Sutcliffe") + ` (${coeffWarn} < ${nsc72} / 72h)`, | |
275 DANGER: | |
276 this.$gettext("Nash-Sutcliffe") + | |
277 ` (${coeffDanger} < ${nsc24} / 72h)`, | |
269 NEUTRAL: this.$gettext("Nash-Sutcliffe not available") | 278 NEUTRAL: this.$gettext("Nash-Sutcliffe not available") |
270 }; | 279 }; |
271 return messagesPerState[this.gaugeStatus]; | 280 return messagesPerState[this.gaugeStatus]; |
272 }, | 281 }, |
273 refGaugeStatusColor() { | 282 refGaugeStatusColor() { |
274 return forecastVsRealityColorCodes[this.refGaugeStatus]; | 283 return forecastVsRealityColorCodes[this.refGaugeStatus]; |
275 }, | 284 }, |
276 refGaugeStatusText() { | 285 refGaugeStatusText() { |
277 const nsc24 = this.config.gm_forecast_vs_reality_nsc_24h; | 286 const nsc24 = this.config.gm_forecast_vs_reality_nsc_24h; |
278 const nsc72 = this.config.gm_forecast_vs_reality_nsc_72h; | 287 const nsc72 = this.config.gm_forecast_vs_reality_nsc_72h; |
288 const coeffWarn = this.refGaugeCoeffs ? this.refGaugeCoeffs[2].value : ""; | |
289 const coeffDanger = this.refGaugeCoeffs | |
290 ? this.refGaugeCoeffs[0].value | |
291 : ""; | |
279 const messagesPerState = { | 292 const messagesPerState = { |
280 OK: this.$gettext("Nash-Sutcliffe") + `>${nsc24} /24h >${nsc72} / 72h`, | 293 OK: |
281 WARNING: this.$gettext("Nash-Sutcliffe") + ` < ${nsc72} / 72h`, | 294 this.$gettext("Nash-Sutcliffe") + |
282 DANGER: this.$gettext("Nash-Sutcliffe") + ` < ${nsc24} / 72h`, | 295 `(${coeffDanger} >${nsc24} /24h ${coeffWarn} >${nsc72} / 72h)`, |
296 WARNING: | |
297 this.$gettext("Nash-Sutcliffe") + ` (${coeffWarn} < ${nsc72} / 72h)`, | |
298 DANGER: | |
299 this.$gettext("Nash-Sutcliffe") + | |
300 ` (${coeffDanger} < ${nsc24} / 72h)`, | |
283 NEUTRAL: this.$gettext("Nash-Sutcliffe not available") | 301 NEUTRAL: this.$gettext("Nash-Sutcliffe not available") |
284 }; | 302 }; |
285 return messagesPerState[this.refGaugeStatus]; | 303 return messagesPerState[this.refGaugeStatus]; |
286 } | 304 } |
287 }, | 305 }, |
296 if (gauges.length > 0) { | 314 if (gauges.length > 0) { |
297 const isrs = gauges[0].get("isrs_code"); | 315 const isrs = gauges[0].get("isrs_code"); |
298 this.$store | 316 this.$store |
299 .dispatch("gauges/getNashSutcliffeForISRS", isrs) | 317 .dispatch("gauges/getNashSutcliffeForISRS", isrs) |
300 .then(response => { | 318 .then(response => { |
319 this.gaugeCoeffs = response.coeffs; | |
301 this.gaugeStatus = classifications.calcForecastVsRealityForNSC( | 320 this.gaugeStatus = classifications.calcForecastVsRealityForNSC( |
302 response | 321 response |
303 ); | 322 ); |
304 }); | 323 }); |
305 } | 324 } |
309 ); | 328 ); |
310 const isrs = gauge.properties.isrs_code; | 329 const isrs = gauge.properties.isrs_code; |
311 this.$store | 330 this.$store |
312 .dispatch("gauges/getNashSutcliffeForISRS", isrs) | 331 .dispatch("gauges/getNashSutcliffeForISRS", isrs) |
313 .then(response => { | 332 .then(response => { |
333 this.refGaugeCoeffs = response.coeffs; | |
314 this.refGaugeStatus = classifications.calcForecastVsRealityForNSC( | 334 this.refGaugeStatus = classifications.calcForecastVsRealityForNSC( |
315 response | 335 response |
316 ); | 336 ); |
317 }); | 337 }); |
318 } | 338 } |