Skip to content
Snippets Groups Projects
Commit 5cb87ddc authored by Tor-Einar Skog's avatar Tor-Einar Skog
Browse files

Merge branch '2024_parameterization'

parents d06b7981 1610847a
Branches
Tags
No related merge requests found
Pipeline #3943 passed
target/ target/
.idea .idea
\ No newline at end of file .vscode
\ No newline at end of file
# AlternariaModel # AlternariaModel (TOMCAST)
<p><img src="src/main/resources/images/ef-20200421-altenaria.jpg" description="Photo: Bilde: S. Abrahamsen, NLR"/></p> <img src="src/main/resources/images/ef-20200421-altenaria.jpg" description="Photo: S. Abrahamsen, NLR"/>
<p>TOMCAST is based on a model that was originally developed for leaf spot diseases in tomato. The model that is used here is tested and adapted to be used against early blight in potato in Denmark (Alternaria solani). The model calculates daily risk values (DSV: Disease Severity Values) based on temperature and leaf wetness the previous day. DSV represents the risk of attack of early blight the previous 24 hours. Daily values of DSV are accumulated until a threshold value is reached, and treatment is recommended. When a spray is performed and entered into the model, accumulation of DSV is reset and starts over at 0.</p>
<p>The model will be evaluated in potato and carrots in Norway in 2020, and is only available for private warnings. Based on experience from other countries, the threshold for a warning to be issued is set to 20.</p>
<h3>When to initiate the model</h3>
<p>Potato plants vary in susceptibility during the season, and gradually become more susceptible. This means that the requirement for protection against early blight vary accordingly. The model is started when the first symptoms are visible, and first treatment is performed (below 0,1% attack).</p>
<h3>Interpretation of results</h3>
<p>The model will be green (no risk) until it reaches 15. From this value the warning will be yellow (possible risk) until the threshold is reached, and the warning turns red (risk of infection).</p>
### Development _Photo: S. Abrahamsen, NLR_
TOMCAST is based on a model that was originally developed for leaf spot diseases in tomato. The model that is used here is tested and adapted to be used against early blight in potato in Denmark (Alternaria solani). The model calculates daily risk values (DSV: Disease Severity Values) based on temperature and leaf wetness the previous day. DSV represents the risk of attack of early blight the previous 24 hours. Daily values of DSV are accumulated until a threshold value is reached, and treatment is recommended. When a spray is performed and entered into the model, accumulation of DSV is reset and starts over at 0.
## Configurable parameters
### Lower temperature threshold for DSV
Default value: 13.0 (as in the original TOMCAST model)
### DSV (Daily Severity Value) Threshold for high infection risk
Default value: 20
## When to initiate the model
Potato plants vary in susceptibility during the season, and gradually become more susceptible. This means that the requirement for protection against early blight vary accordingly. The model is started when the first symptoms are visible, and first treatment is performed (below 0,1% attack).
## Interpretation of results
The model will be green (no risk) until it reaches 15. From this value the warning will be yellow (possible risk) until the threshold is reached, and the warning turns red (risk of infection).
## Development
Requirements:
* Maven
* Java 11
Clone Gitlab repository Clone Gitlab repository
``` ```
$ git clone https://gitlab.nibio.no/VIPS/models/java/Model_ALTERNARIA.git $ git clone https://gitlab.nibio.no/VIPS/models/java/Model_ALTERNARIA.git
$ cd Model_ALTERNARIA $ cd Model_ALTERNARIA
```
Build
```
$ mvn install
``` ```
\ No newline at end of file
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* Organization : NIBIO, Ås * Organization : NIBIO, Ås
* Department : VIPS * Department : VIPS
* *
* Author : bhabesh * Author : bhabesh & Tor-Einar Skog
* *
* *
* File Name : DataMatrix.java * File Name : DataMatrix.java
...@@ -16,22 +16,23 @@ ...@@ -16,22 +16,23 @@
*/ */
/* /*
* *
*
Copyright (c) 2016 NIBIO <http://www.nibio.no/>. * Copyright (c) 2020-2024 NIBIO <http://www.nibio.no/>.
*
This file is part of AlternariaModel. * This file is part of AlternariaModel.
AlternariaModel is free software: you can redistribute it and/or modify *
it under the terms of the NIBIO Open Source License as published by * This program is free software: you can redistribute it and/or modify
NIBIO, either version 1 of the License, or (at your option) any * it under the terms of the GNU Affero General Public License as published by
later version. * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
AlternariaModel is distributed in the hope that it will be useful, *
but WITHOUT ANY WARRANTY; without even the implied warranty of * This program is distributed in the hope that it will be useful,
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * but WITHOUT ANY WARRANTY; without even the implied warranty of
NIBIO Open Source License for more details. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
You should have received a copy of the NIBIO Open Source License *
along with AlternariaModel. If not, see <http://www.nibio.no/licenses/>. * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
...@@ -42,6 +43,7 @@ import no.nibio.vips.util.DateMap; ...@@ -42,6 +43,7 @@ import no.nibio.vips.util.DateMap;
/** /**
* *
* @author bhabesh * @author bhabesh
* @author Tor-Einar Skog <tor-einar.skog@nibio.no>
*/ */
public class DataMatrix extends DateMap{ public class DataMatrix extends DateMap{
public final static String WET_HOUR = "WH"; // Leaf wetness 2 m, minutes per hour public final static String WET_HOUR = "WH"; // Leaf wetness 2 m, minutes per hour
...@@ -53,8 +55,8 @@ public class DataMatrix extends DateMap{ ...@@ -53,8 +55,8 @@ public class DataMatrix extends DateMap{
public final static String SPRAYING_DATE = "sprayingDate"; // Spray Date public final static String SPRAYING_DATE = "sprayingDate"; // Spray Date
public final static String THRESHOLD_DSV_BASE = "THRESHOLD_DSV_BASE"; // THRESHOLD_DSV_BASE public final static String THRESHOLD_DSV_BASE = "THRESHOLD_DSV_BASE"; // THRESHOLD_DSV_BASE
public final static String THRESHOLD_DSV_MAX = "THRESHOLD_DSV_MAX"; // THRESHOLD_DSV_MAX public final static String THRESHOLD_DSV_MAX = "thresholdDSVMax"; // THRESHOLD_DSV_MAX
public final static String THRESHOLD_DSV_TEMP_MIN = "thresholdDSVTempMin";
......
Copyright (C) 2024 Tor-Einar Skog <tor-einar.skog@nibio.no>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
...@@ -26,35 +26,3 @@ observations - list of weather data. The following parameters are required:\n\ ...@@ -26,35 +26,3 @@ observations - list of weather data. The following parameters are required:\n\
* TM - Average temperature (Degrees Celcius)\n\ * TM - Average temperature (Degrees Celcius)\n\
* BT - Leaf wetness (Minutes/hour) (IF you don't have leaf wetness, you must provide UM (relative humidity). Then we will calculate the leaf wetness.\n\ * BT - Leaf wetness (Minutes/hour) (IF you don't have leaf wetness, you must provide UM (relative humidity). Then we will calculate the leaf wetness.\n\
sprayingDate - (Optional) Farmers can choose multiple spraying dates (upto four spraying dates). sprayingDate - (Optional) Farmers can choose multiple spraying dates (upto four spraying dates).
license= Copyright (c) 2020 NIBIO <http://www.nibio.no/>. \n \nThis file is part of AlternariaModel. \nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU Affero General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU Affero General Public License for more details.\n\nYou should have received a copy of the GNU Affero General Public License\nalong with this program. If not, see <https://www.gnu.org/licenses/>.
sampleconfig={ \n\
\t "loginInfo": { \n\
\t\t "username": "example", \n\
\t\t "password": "example" \n\
\t }, \n\
\t "modelId": "ALTERNARIA", \n\
\t "configParameters": { \n\
\t "timeZone": "Europe/Oslo", \n\
\t "observations": [ \n\
\t { \n\
\t\t "elementMeasurementTypeId": "TM", \n\
\t\t "logIntervalId": 1, \n\
\t\t "timeMeasured": "2018-08-11T00:00:00+02:00", \n\
\t\t "value": 10.46 \n\
\t }, \n\
\t { \n\
\t\t "elementMeasurementTypeId": "BT", \n\
\t\t "logIntervalId": 1, \n\
\t\t "timeMeasured": "2018-08-11T00:00:00+02:00", \n\
\t\t "value": 60.0 \n\
\t } \n\
\t ], \n\
\t "sprayingDates": [ \n\
\t\t "2018-07-02T22:00:00Z", \n\
\t\t "2018-07-30T22:00:00Z", \n\
\t\t "2018-09-04T22:00:00Z" \n\
\t ] \n\
\t } \n\
} \n\
...@@ -19,4 +19,3 @@ name=TOMCAST (FAST - Dew) modell for Alternaria ...@@ -19,4 +19,3 @@ name=TOMCAST (FAST - Dew) modell for Alternaria
description= <p>{{filename="/images/ef-20200421-altenaria.jpg" description="Photo: Bilde: S. Abrahamsen, NLR"}}</p>\n<p>TOMCAST er basert p&aring; en modell utviklet for varsling av bladflekksjukdommer i tomat. Versjonen som blir brukt her er testet og tilpasset t&oslash;rrflekksjuke i potet (Alternaria solani) i Danmark. Modellen beregner daglige risikoverdier (DSV: Disease Severity Value) basert p&aring; temperatur og bladfuktighet siste d&oslash;gn. DSV representerer risikoen for angrep av t&oslash;rrflekksjuke siste d&oslash;gn. Daglige DSV-verdier blir summert frem til en terskel er n&aring;dd og behandling er anbefalt. Modellen er laget slik at akkumulering av DSV nullstilles n&aring;r spr&oslash;yting gjennomf&oslash;res, og akkumulering starter p&aring; nytt fra 0.</p>\n<p>Modellen er under utpr&oslash;ving i 2020, og vil bli testet b&aring;de i gulrot og i potet. Det vil kun v&aelig;re mulig &aring; starte private varler for denne modellen. Basert p&aring; erfaringer fra andre land er terskelverdien for r&oslash;dt varsel satt til 20.</p>\n<h3>Oppstart av varsel</h3>\n<p>Potetplanter varierer i mottakelighet for t&oslash;rrflekksjuke gjennom sesongen, og de blir gradvis mer og mer mottakelige. Dette betyr at behovet for beskyttelse ogs&aring; varierer tilsvarende. Modellen startes n&aring;r man ser de f&oslash;rste symptomene p&aring; t&oslash;rrflekksjuke og gjennomf&oslash;rer f&oslash;rste behandling (under 0,1% angrep).</p>\n<h3>Tolking av varsel</h3>\n<p>Modellen vil vise gr&oslash;nt (ingen fare) frem til den akkumulerte risikoverdien er 15. Fra denne verdien frem til terskelverdien (20) vil varselet v&aelig;re gult (mulig fare), og deretter g&aring; over til r&oslash;dt (fare).</p> description= <p>{{filename="/images/ef-20200421-altenaria.jpg" description="Photo: Bilde: S. Abrahamsen, NLR"}}</p>\n<p>TOMCAST er basert p&aring; en modell utviklet for varsling av bladflekksjukdommer i tomat. Versjonen som blir brukt her er testet og tilpasset t&oslash;rrflekksjuke i potet (Alternaria solani) i Danmark. Modellen beregner daglige risikoverdier (DSV: Disease Severity Value) basert p&aring; temperatur og bladfuktighet siste d&oslash;gn. DSV representerer risikoen for angrep av t&oslash;rrflekksjuke siste d&oslash;gn. Daglige DSV-verdier blir summert frem til en terskel er n&aring;dd og behandling er anbefalt. Modellen er laget slik at akkumulering av DSV nullstilles n&aring;r spr&oslash;yting gjennomf&oslash;res, og akkumulering starter p&aring; nytt fra 0.</p>\n<p>Modellen er under utpr&oslash;ving i 2020, og vil bli testet b&aring;de i gulrot og i potet. Det vil kun v&aelig;re mulig &aring; starte private varler for denne modellen. Basert p&aring; erfaringer fra andre land er terskelverdien for r&oslash;dt varsel satt til 20.</p>\n<h3>Oppstart av varsel</h3>\n<p>Potetplanter varierer i mottakelighet for t&oslash;rrflekksjuke gjennom sesongen, og de blir gradvis mer og mer mottakelige. Dette betyr at behovet for beskyttelse ogs&aring; varierer tilsvarende. Modellen startes n&aring;r man ser de f&oslash;rste symptomene p&aring; t&oslash;rrflekksjuke og gjennomf&oslash;rer f&oslash;rste behandling (under 0,1% angrep).</p>\n<h3>Tolking av varsel</h3>\n<p>Modellen vil vise gr&oslash;nt (ingen fare) frem til den akkumulerte risikoverdien er 15. Fra denne verdien frem til terskelverdien (20) vil varselet v&aelig;re gult (mulig fare), og deretter g&aring; over til r&oslash;dt (fare).</p>
statusInterpretation=Modellen vil vise gr\u00f8nt (ingen fare) frem til den akkumulerte risikoverdien er 15. Fra denne verdien frem til terskelverdien (20) vil varselet v\u00e6re gult (mulig fare), og deretter g\u00e5 over til r\u00f8dt (fare). statusInterpretation=Modellen vil vise gr\u00f8nt (ingen fare) frem til den akkumulerte risikoverdien er 15. Fra denne verdien frem til terskelverdien (20) vil varselet v\u00e6re gult (mulig fare), og deretter g\u00e5 over til r\u00f8dt (fare).
usage=TODO usage=TODO
license=Copyright (c) 2020 NIBIO <http://www.nibio.no/>. \n \nThis file is part of AlternariaModel. \nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU Affero General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU Affero General Public License for more details.\n\nYou should have received a copy of the GNU Affero General Public License\nalong with this program. If not, see <https://www.gnu.org/licenses/>.
{
"loginInfo": {
"username": "example",
"password": "example"
},
"modelId": "ALTERNARIA",
"configParameters": {
"sprayingDates": [
"2018-07-02T22:00:00Z",
"2018-07-30T22:00:00Z",
"2018-09-04T22:00:00Z"
],
"thresholdDSVTempMin": "10.0",
"thresholdDSVMax": "20.0",
"timeZone": "Europe/Oslo",
"observations": [
{
"elementMeasurementTypeId": "TM",
"logIntervalId": 1,
"timeMeasured": "2018-08-11T00:00:00+02:00",
"value": 10.46
},
{
"elementMeasurementTypeId": "BT",
"logIntervalId": 1,
"timeMeasured": "2018-08-11T00:00:00+02:00",
"value": 60
}
]
}
}
\ No newline at end of file
/* /*
* To change this license header, choose License Headers in Project Properties. * Copyright (c) 2020 NIBIO <http://www.nibio.no/>.
* To change this template file, choose Tools | Templates
* and open the template in the editor. This file is part of AlternariaModel.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package no.nibio.vips.model.alternariamodel; package no.nibio.vips.model.alternariamodel;
...@@ -25,6 +37,7 @@ import org.junit.jupiter.api.AfterAll; ...@@ -25,6 +37,7 @@ import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeAll;
import static org.junit.jupiter.api.Assertions.*; import static org.junit.jupiter.api.Assertions.*;
import static org.junit.jupiter.api.DynamicTest.stream;
/** /**
* *
...@@ -104,6 +117,90 @@ public class AlternariaModelTest { ...@@ -104,6 +117,90 @@ public class AlternariaModelTest {
*/ */
}
@org.junit.jupiter.api.Test
public void testGetResultWithThresholdDSVTempMin() throws Exception {
System.out.println("getResultWithThresholdDSVTempMin");
ModelConfiguration config = this.getConfiguration(getWeatherDataFile());
config.setConfigParameter("sprayingDates", this.getConfigurationSprayingDates(getResetDataFile()));
config.setConfigParameter(DataMatrix.THRESHOLD_DSV_TEMP_MIN, 10.0);
AlternariaModel instance = new AlternariaModel();
instance.setConfiguration(config);
List<Result> result = instance.getResult();
assertNotNull(result);
config.setConfigParameter(DataMatrix.THRESHOLD_DSV_TEMP_MIN, "10.0");
instance.setConfiguration(config);
result = instance.getResult();
assertNotNull(result);
/*
for(Result res:result)
{
// LOGGER.log(Level.INFO, res.toString());
System.out.println(res.toString());
}*/
config.setConfigParameter(DataMatrix.THRESHOLD_DSV_TEMP_MIN, "13.0");
//System.out.println(config.toJSON());
instance.setConfiguration(config);
result = instance.getResult();
assertNotNull(result);
/*
for(Result res:result)
{
// LOGGER.log(Level.INFO, res.toString());
System.out.println(res.toString());
} */
}
@org.junit.jupiter.api.Test
public void testGetResultWithThresholdDSVMax() throws Exception {
System.out.println("getResultWithThresholdDSVMax");
ModelConfiguration config = this.getConfiguration(getWeatherDataFile());
config.setConfigParameter("sprayingDates", this.getConfigurationSprayingDates(getResetDataFile()));
config.setConfigParameter(DataMatrix.THRESHOLD_DSV_MAX, 21);
AlternariaModel instance = new AlternariaModel();
instance.setConfiguration(config);
List<Result> result = instance.getResult();
assertNotNull(result);
config.setConfigParameter(DataMatrix.THRESHOLD_DSV_MAX, "21");
instance.setConfiguration(config);
result = instance.getResult();
assertNotNull(result);
/*
for(Result res:result)
{
// LOGGER.log(Level.INFO, res.toString());
System.out.println(res.toString());
}*/
config.setConfigParameter(DataMatrix.THRESHOLD_DSV_MAX, "13.0");
//System.out.println(config.toJSON());
instance.setConfiguration(config);
result = instance.getResult();
assertNotNull(result);
/*
for(Result res:result)
{
// LOGGER.log(Level.INFO, res.toString());
System.out.println(res.toString());
} */
} }
/** /**
...@@ -149,9 +246,8 @@ public class AlternariaModelTest { ...@@ -149,9 +246,8 @@ public class AlternariaModelTest {
public void testGetLicense() { public void testGetLicense() {
System.out.println("getLicense"); System.out.println("getLicense");
AlternariaModel instance = new AlternariaModel(); AlternariaModel instance = new AlternariaModel();
String expResult = "";
String result = instance.getLicense(); String result = instance.getLicense();
assertNotNull(result); assertTrue(result.contains("GNU Affero"));
} }
/** /**
...@@ -251,15 +347,13 @@ public class AlternariaModelTest { ...@@ -251,15 +347,13 @@ public class AlternariaModelTest {
/** /**
* Test of getSampleConfig method, of class AlternariaModel. * Test of getSampleConfig method, of class AlternariaModel.
* TODO - Recheck the functionality
*/ */
@org.junit.jupiter.api.Test @org.junit.jupiter.api.Test
public void testGetSampleConfig() { public void testGetSampleConfig() {
System.out.println("getSampleConfig"); System.out.println("getSampleConfig");
AlternariaModel instance = new AlternariaModel(); AlternariaModel instance = new AlternariaModel();
String expResult = "";
String result = instance.getSampleConfig(); String result = instance.getSampleConfig();
assertNotNull(result); assertTrue(result.contains("configParameters"));
} }
/** /**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment