From b5f5a7715cd5352d0a884ee79924474127c6ef11 Mon Sep 17 00:00:00 2001 From: Tor-Einar Skog <tor-einar.skog@nibio.no> Date: Thu, 21 Dec 2023 14:11:48 +0100 Subject: [PATCH] Change warning status classification and legend [GRIDV-77] --- PSILARTEMP.cfg | 6 ++++-- PSILARTEMP.py | 9 +++++++-- mapfile/template.j2 | 26 +++++++++++++++++++------- 3 files changed, 30 insertions(+), 11 deletions(-) diff --git a/PSILARTEMP.cfg b/PSILARTEMP.cfg index c5afb6a..03d5579 100644 --- a/PSILARTEMP.cfg +++ b/PSILARTEMP.cfg @@ -3,15 +3,17 @@ languages=en,nb [i18n.en] -no_forecast = Flight period ended +no_forecast = Forecast not started no_risk = Flight period not started possible_risk = Flight period starting high_risk = Peak flight activity +flight_ended = 1st generation flight period ended day_degrees = Day degrees [i18n.nb] -no_forecast = Sverming avsluttet +no_forecast = Varsel ikke startet no_risk = Sverming har ikke begynt possible_risk = Sverming i startfasen high_risk = Sverming på sitt mest aktive +flight_ended = Sverming av 1. generasjon avsluttet day_degrees = Døgngrader \ No newline at end of file diff --git a/PSILARTEMP.py b/PSILARTEMP.py index 2a32c55..57cbad1 100755 --- a/PSILARTEMP.py +++ b/PSILARTEMP.py @@ -62,8 +62,13 @@ else: os.rename(f"{tmp_path}DD_unmasked.nc", f"{tmp_path}DD.nc") # Add the DD threshold classification => warning status -# (A>0)*(A<=260)*2 + (A>260)*(A<=360)*3 + (A>360)*(A<=560)*4 + (A>560)*0 -subprocess.run(f'cdo -aexpr,"WARNING_STATUS=(TM>0)*(TM<=260)*2 + (TM>260)*(TM<=360)*3 + (TM>360)*(TM<=560)*4 + (TM>560)*0" {tmp_path}DD.nc {tmp_path}result.nc', shell=True) +# 0: DD == 0 # Forecast not started +# 2: DD <= 260 # Flight period not started +# 3: 260 < DD <= 360 # Flight period starting +# 4: 360 < DD <= 560 # Peak flight period +# 5: 560 < DD # 1st generation flight period ended +# (A>0)*(A<=260)*2 + (A>260)*(A<=360)*3 + (A>360)*(A<=560)*4 + (A>560)*5 +subprocess.run(f'cdo -aexpr,"WARNING_STATUS=(TM>0)*(TM<=260)*2 + (TM>260)*(TM<=360)*3 + (TM>360)*(TM<=560)*4 + (TM>560)*5" {tmp_path}DD.nc {tmp_path}result.nc', shell=True) #""" diff --git a/mapfile/template.j2 b/mapfile/template.j2 index fa06c0a..050ad3d 100644 --- a/mapfile/template.j2 +++ b/mapfile/template.j2 @@ -112,7 +112,7 @@ LAYER { \"classification\": 0, \"legendLabel\": \"{{ language.no_forecast }}\", - \"legendIconCSS\": \"width: 25px; background-color: #707070;\" + \"legendIconCSS\": \"width: 25px; background-color: #B0B0B0;\" }, { \"classification\": 2, @@ -128,6 +128,11 @@ LAYER \"classification\": 4, \"legendLabel\": \"{{ language.high_risk }}\", \"legendIconCSS\": \"width: 25px; background-color: #FF0000;\" + } , + { + \"classification\": 4, + \"legendLabel\": \"{{ language.flight_ended }}\", + \"legendIconCSS\": \"width: 25px; background-color: #707070\" } ] } @@ -139,33 +144,40 @@ LAYER # class using simple string comparison, equivalent to ([pixel] = 0) CLASS - NAME "Model not running" + NAME "Forecast not started" EXPRESSION ([pixel] >= 0 AND [pixel] < 2) STYLE - COLOR 112 112 112 + COLOR 176 176 176 END END CLASS - NAME "No infection risk" + NAME "Flight period not started" EXPRESSION ([pixel] >= 2 AND [pixel] < 3) STYLE COLOR 0 180 87 END END CLASS - NAME "Possible infection risk" + NAME "Flight period starting" EXPRESSION ([pixel] >= 3 AND [pixel] < 4) STYLE COLOR 255 204 0 END END CLASS - NAME "High infection risk" - EXPRESSION ([pixel] >= 4) + NAME "Peak flight periodk" + EXPRESSION ([pixel] >= 4 AND [pixel] < 5) STYLE COLOR 255 0 0 END END + CLASS + NAME "1st generation flight period ended" + EXPRESSION ([pixel] >= 5) + STYLE + COLOR 112 112 112 + END + END END # Layer LAYER -- GitLab