Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • feature/vips-test
  • main
  • release
  • v1.0.1
  • v1.0.2
  • v1.0.3
  • v1.1.0
  • v1.1.1
  • v1.1.10
  • v1.1.11
  • v1.1.12
  • v1.1.13
  • v1.1.14
  • v1.1.15
  • v1.1.16
  • v1.1.17
  • v1.1.18
  • v1.1.19
  • v1.1.2
  • v1.1.20
  • v1.1.21
  • v1.1.22
  • v1.1.23
  • v1.1.3
  • v1.1.4
  • v1.1.5
  • v1.1.6
  • v1.1.7
  • v1.1.8
  • v1.1.9
30 results

Target

Select target project
  • VIPS/models/java/Model_ALTERNARIA
1 result
Select Git revision
  • feature/vips-test
  • main
  • release
  • v1.0.1
  • v1.0.2
  • v1.0.3
  • v1.1.0
  • v1.1.1
  • v1.1.10
  • v1.1.11
  • v1.1.12
  • v1.1.13
  • v1.1.14
  • v1.1.15
  • v1.1.16
  • v1.1.17
  • v1.1.18
  • v1.1.19
  • v1.1.2
  • v1.1.20
  • v1.1.21
  • v1.1.22
  • v1.1.23
  • v1.1.3
  • v1.1.4
  • v1.1.5
  • v1.1.6
  • v1.1.7
  • v1.1.8
  • v1.1.9
30 results
Show changes
Commits on Source (5)
......@@ -10,7 +10,7 @@
<groupId>no.nibio.vips.model</groupId>
<artifactId>AlternariaModel</artifactId>
<version>1.1.14-SNAPSHOT</version>
<version>1.1.15-SNAPSHOT</version>
<packaging>jar</packaging>
<dependencies>
......
......@@ -114,6 +114,7 @@ public class AlternariaModel extends I18nImpl implements Model {
// Date currentDate =
// this.dataMatrix.getFirstDateWithParameterValue(DataMatrix.LEAF_WETNESS_DURATION);
List<Result> results = new ArrayList<>();
//System.out.println(dataMatrix.toCSV());
Date currentDate = this.dataMatrix.getFirstDateWithParameterValue(DataMatrix.TEMPERATURE_MEAN);
Date endDate = this.dataMatrix.getLastDateWithParameterValue(DataMatrix.TEMPERATURE_MEAN);
......@@ -544,46 +545,46 @@ public class AlternariaModel extends I18nImpl implements Model {
public int getDSV_DAILY(double temp, int lw) {
int dsvResult = 0;
if ((temp >= this.THRESHOLD_DSV_TEMP_MIN && temp <= 17) && (lw <= 6))
if ((temp >= this.THRESHOLD_DSV_TEMP_MIN && temp < 18) && (lw < 7))
dsvResult = 0;
if ((temp >= this.THRESHOLD_DSV_TEMP_MIN && temp <= 17) && (lw >= 7 && lw <= 15))
if ((temp >= this.THRESHOLD_DSV_TEMP_MIN && temp < 18) && (lw >= 7 && lw < 16))
dsvResult = 1;
if ((temp >= this.THRESHOLD_DSV_TEMP_MIN && temp <= 17) && (lw >= 16 && lw <= 20))
if ((temp >= this.THRESHOLD_DSV_TEMP_MIN && temp < 18) && (lw >= 16 && lw < 21))
dsvResult = 2;
if ((temp >= this.THRESHOLD_DSV_TEMP_MIN && temp <= 17) && (lw > 21))
if ((temp >= this.THRESHOLD_DSV_TEMP_MIN && temp < 18) && (lw >= 21))
dsvResult = 3;
if ((temp >= 18 && temp <= 20) && (lw <= 3))
if ((temp >= 18 && temp < 21) && (lw < 4))
dsvResult = 0;
if ((temp >= 18 && temp <= 20) && (lw >= 4 && lw <= 8))
if ((temp >= 18 && temp < 21) && (lw >= 4 && lw < 9))
dsvResult = 1;
if ((temp >= 18 && temp <= 20) && (lw >= 9 && lw <= 15))
if ((temp >= 18 && temp < 21) && (lw >= 9 && lw < 16))
dsvResult = 2;
if ((temp >= 18 && temp <= 20) && (lw >= 16 && lw <= 22))
if ((temp >= 18 && temp < 21) && (lw >= 16 && lw < 23))
dsvResult = 3;
if ((temp >= 18 && temp <= 20) && (lw >= 23))
if ((temp >= 18 && temp < 21) && (lw >= 23))
dsvResult = 4;
if ((temp >= 21 && temp <= 25) && (lw <= 2))
if ((temp >= 21 && temp < 26) && (lw < 3))
dsvResult = 0;
if ((temp >= 21 && temp <= 25) && (lw >= 3 && lw <= 5))
if ((temp >= 21 && temp < 26) && (lw >= 3 && lw < 6))
dsvResult = 1;
if ((temp >= 21 && temp <= 25) && (lw >= 6 && lw <= 12))
if ((temp >= 21 && temp < 26) && (lw >= 6 && lw < 13))
dsvResult = 2;
if ((temp >= 21 && temp <= 25) && (lw >= 13 && lw <= 20))
if ((temp >= 21 && temp < 26) && (lw >= 13 && lw < 21))
dsvResult = 3;
if ((temp >= 21 && temp <= 25) && (lw >= 21))
if ((temp >= 21 && temp < 26) && (lw >= 21))
dsvResult = 4;
if ((temp >= 26 && temp <= 29) && (lw <= 3))
if ((temp >= 26 && temp < 30) && (lw < 4))
dsvResult = 0;
if ((temp >= 26 && temp <= 29) && (lw >= 4 && lw <= 8))
if ((temp >= 26 && temp < 30) && (lw >= 4 && lw < 9))
dsvResult = 1;
if ((temp >= 26 && temp <= 29) && (lw >= 9 && lw <= 15))
if ((temp >= 26 && temp < 30) && (lw >= 9 && lw < 16))
dsvResult = 2;
if ((temp >= 26 && temp <= 29) && (lw >= 16 && lw <= 22))
if ((temp >= 26 && temp < 30) && (lw >= 16 && lw < 23))
dsvResult = 3;
if ((temp >= 26 && temp <= 29) && (lw >= 23))
if ((temp >= 26 && temp < 30) && (lw >= 23))
dsvResult = 4;
return dsvResult;
......
......@@ -25,6 +25,7 @@ import com.fasterxml.jackson.databind.MappingJsonFactory;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
......@@ -32,6 +33,8 @@ import no.nibio.vips.entity.ModelConfiguration;
import no.nibio.vips.entity.Result;
import no.nibio.vips.entity.WeatherObservation;
import no.nibio.vips.model.ModelId;
import no.nibio.vips.util.DateUtil;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeEach;
......@@ -117,6 +120,38 @@ public class AlternariaModelTest {
*/
}
@org.junit.jupiter.api.Test
public void testGetResult2024() throws Exception {
System.out.println("getResult2024");
ModelConfiguration config = this.getConfiguration("/kvelde_weatherdata.json");
List<Date> sprayingDates = List.of(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").parse("2024-07-17T22:00:00+0000"));
config.setConfigParameter("sprayingDates", sprayingDates);
AlternariaModel instance = new AlternariaModel();
instance.setConfiguration(config);
List<Result> result = instance.getResult();
assertNotNull(result);
// Test DSV SUM
Date testDate = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").parse("2024-07-15T22:00:00+0000");
for(Result res:result)
{
if(res.getValidTimeStart().equals(testDate))
{
assertEquals("28",res.getValue("ALTERNARIA", "DSV_SUM"));
}
}
/*
for(Result res:result)
{
// LOGGER.log(Level.INFO, res.toString());
System.out.println(res.toString());
}*/
}
@org.junit.jupiter.api.Test
......
This diff is collapsed.