diff --git a/ADASMELIAE.cfg b/ADASMELIAE.cfg index 8709db1e7a48646be0b766f136c46feb80719fe3..5b2a9c744a0a5170c9735092ecdf6e4f783c228b 100644 --- a/ADASMELIAE.cfg +++ b/ADASMELIAE.cfg @@ -3,13 +3,11 @@ languages=en,nb [i18n.en] -low_risk = Low migration risk -medium_risk = Medium migration risk -high_risk = High migration risk +low_risk = Low risk of migration of adult pollen beetle +high_risk = High risk of migration of adult pollen beetle temperature = Maximum air temperature [i18n.nb] low_risk = Lav migreringsrisiko -medium_risk = Middels migreringsrisiko high_risk = Høy migreringsrisiko temperature = Maksimum lufttemperatur \ No newline at end of file diff --git a/ADASMELIAE.py b/ADASMELIAE.py index 4894b41af6e96bae18fede590afe6b639790719a..707b5da526a71af1566c4684bbdbe41cd5bd536b 100755 --- a/ADASMELIAE.py +++ b/ADASMELIAE.py @@ -74,8 +74,7 @@ logging.basicConfig( tm_max = "air_temperature_2m_max" -THRESHOLD_HIGH = 15 -THRESHOLD_MEDIUM = 12 +THRESHOLD = 15 # Run given command using subprocess.run. Handle logging. @@ -190,12 +189,10 @@ if __name__ == "__main__": ) # Classifying warning status for the model - # temperature < 12 --> 2 (Yellow) - # 12 <= temperature < 15 --> 3 (Orange) - # temperature >= 15 --> 4 (Red) - logging.info(f"Calculate warning status by checking {tm_max}") + # temperature < 15 --> 2 (Green) + # temperature >= 15 --> 4 (Red) 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. diff --git a/mapfile/template.j2 b/mapfile/template.j2 index 7004f2f4b8b967a37bc7974491d6d48daf611792..1181313eb7c59619e14128da232eef64617a8c62 100644 --- a/mapfile/template.j2 +++ b/mapfile/template.j2 @@ -122,17 +122,12 @@ LAYER { \"classification\": 2, \"legendLabel\": \"{{ language.low_risk }}\", - \"legendIconCSS\": \"width: 25px; background-color: #FFDF00;\" - }, - { - \"classification\": 3, - \"legendLabel\": \"{{ language.medium_risk }}\", - \"legendIconCSS\": \"width: 25px; background-color: #FF8C00;\" + \"legendIconCSS\": \"width: 25px; background-color: #3ac47d;\" }, { \"classification\": 4, \"legendLabel\": \"{{ language.high_risk }}\", - \"legendIconCSS\": \"width: 25px; background-color: #FF0000;\" + \"legendIconCSS\": \"width: 25px; background-color: #d92550;\" } ] } @@ -145,23 +140,16 @@ LAYER CLASS NAME "Low infection risk" - EXPRESSION ([pixel] >= 0 AND [pixel] <= 2) - STYLE - COLOR 255 223 0 # Yellow - END - END - CLASS - NAME "Medium infection risk" - EXPRESSION ([pixel] > 2 AND [pixel] <= 3) + EXPRESSION ([pixel] >= 0 AND [pixel] < 15) STYLE - COLOR 255 140 0 # Orange + COLOR 58 196 125 # Green END END CLASS NAME "High infection risk" - EXPRESSION ([pixel] > 3) + EXPRESSION ([pixel] >= 15) STYLE - COLOR 255 0 0 # Red + COLOR 217 37 80 # Red END END END # Layer