Skip to content
Snippets Groups Projects
Commit 55f965c0 authored by Lene Wasskog's avatar Lene Wasskog
Browse files

feat: Change to two warning statuses - green and red

parent 8c7453f9
No related branches found
No related tags found
No related merge requests found
Pipeline #3793 passed
...@@ -3,13 +3,11 @@ ...@@ -3,13 +3,11 @@
languages=en,nb languages=en,nb
[i18n.en] [i18n.en]
low_risk = Low migration risk low_risk = Low risk of migration of adult pollen beetle
medium_risk = Medium migration risk high_risk = High risk of migration of adult pollen beetle
high_risk = High migration risk
temperature = Maximum air temperature temperature = Maximum air temperature
[i18n.nb] [i18n.nb]
low_risk = Lav migreringsrisiko low_risk = Lav migreringsrisiko
medium_risk = Middels migreringsrisiko
high_risk = Høy migreringsrisiko high_risk = Høy migreringsrisiko
temperature = Maksimum lufttemperatur temperature = Maksimum lufttemperatur
\ No newline at end of file
...@@ -74,8 +74,7 @@ logging.basicConfig( ...@@ -74,8 +74,7 @@ logging.basicConfig(
tm_max = "air_temperature_2m_max" tm_max = "air_temperature_2m_max"
THRESHOLD_HIGH = 15 THRESHOLD = 15
THRESHOLD_MEDIUM = 12
# Run given command using subprocess.run. Handle logging. # Run given command using subprocess.run. Handle logging.
...@@ -190,12 +189,10 @@ if __name__ == "__main__": ...@@ -190,12 +189,10 @@ if __name__ == "__main__":
) )
# Classifying warning status for the model # Classifying warning status for the model
# temperature < 12 --> 2 (Yellow) # temperature < 15 --> 2 (Green)
# 12 <= temperature < 15 --> 3 (Orange) # temperature >= 15 --> 4 (Red)
# temperature >= 15 --> 4 (Red)
logging.info(f"Calculate warning status by checking {tm_max}")
run_command( run_command(
command=f"cdo -s -aexpr,'WARNING_STATUS = {tm_max} < {THRESHOLD_MEDIUM} ? 2 : -1; WARNING_STATUS = {tm_max} < {THRESHOLD_HIGH} && WARNING_STATUS == -1 ? 3 : WARNING_STATUS ; WARNING_STATUS = {tm_max} >= {THRESHOLD_HIGH} && WARNING_STATUS == -1 ? 4 : WARNING_STATUS' {max_temp_in_period_file} {unmasked_result_file}", command=f'cdo -s -aexpr,"WARNING_STATUS = {tm_max} < {THRESHOLD} ? 2 : 4" {max_temp_in_period_file} {unmasked_result_file}',
) )
# Mask results using a CSV file with polygons. Env variable MASK_FILE must be set, or else we use the file as it is. # Mask results using a CSV file with polygons. Env variable MASK_FILE must be set, or else we use the file as it is.
......
...@@ -122,17 +122,12 @@ LAYER ...@@ -122,17 +122,12 @@ LAYER
{ {
\"classification\": 2, \"classification\": 2,
\"legendLabel\": \"{{ language.low_risk }}\", \"legendLabel\": \"{{ language.low_risk }}\",
\"legendIconCSS\": \"width: 25px; background-color: #FFDF00;\" \"legendIconCSS\": \"width: 25px; background-color: #3ac47d;\"
},
{
\"classification\": 3,
\"legendLabel\": \"{{ language.medium_risk }}\",
\"legendIconCSS\": \"width: 25px; background-color: #FF8C00;\"
}, },
{ {
\"classification\": 4, \"classification\": 4,
\"legendLabel\": \"{{ language.high_risk }}\", \"legendLabel\": \"{{ language.high_risk }}\",
\"legendIconCSS\": \"width: 25px; background-color: #FF0000;\" \"legendIconCSS\": \"width: 25px; background-color: #d92550;\"
} }
] ]
} }
...@@ -145,23 +140,16 @@ LAYER ...@@ -145,23 +140,16 @@ LAYER
CLASS CLASS
NAME "Low infection risk" NAME "Low infection risk"
EXPRESSION ([pixel] >= 0 AND [pixel] <= 2) EXPRESSION ([pixel] >= 0 AND [pixel] < 15)
STYLE
COLOR 255 223 0 # Yellow
END
END
CLASS
NAME "Medium infection risk"
EXPRESSION ([pixel] > 2 AND [pixel] <= 3)
STYLE STYLE
COLOR 255 140 0 # Orange COLOR 58 196 125 # Green
END END
END END
CLASS CLASS
NAME "High infection risk" NAME "High infection risk"
EXPRESSION ([pixel] > 3) EXPRESSION ([pixel] >= 15)
STYLE STYLE
COLOR 255 0 0 # Red COLOR 217 37 80 # Red
END END
END END
END # Layer END # Layer
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment