diff --git a/src/main/java/no/bioforsk/vips/model/applescabmodel/AppleScabModel.java b/src/main/java/no/bioforsk/vips/model/applescabmodel/AppleScabModel.java index 415f05a1bd965767edd8a742edd2f7b7e46c50ad..f244862fbf6b80641dc6c1b6e8cd2c0ebf62426b 100644 --- a/src/main/java/no/bioforsk/vips/model/applescabmodel/AppleScabModel.java +++ b/src/main/java/no/bioforsk/vips/model/applescabmodel/AppleScabModel.java @@ -100,7 +100,7 @@ public class AppleScabModel extends I18nImpl implements Model{ { Result result = new ResultImpl(); result.setResultValidTime(timeStamp); - result.setValue(AppleScabCalculations.ASCOSPORE_MATURITY, String.valueOf(this.calculations.getParamDoubleValueForDate(timeStamp, AppleScabCalculations.ASCOSPORE_MATURITY))); + result.setValue(AppleScabCalculations.ASCOSPORE_MATURITY, this.calculations.getParamDoubleValueForDate(timeStamp, AppleScabCalculations.ASCOSPORE_MATURITY) != null ? String.valueOf(this.calculations.getParamDoubleValueForDate(timeStamp, AppleScabCalculations.ASCOSPORE_MATURITY)) : ""); result.setValue(AppleScabCalculations.ACCUMULATED_MILLS, String.valueOf(this.calculations.getParamDoubleValueForDate(timeStamp, AppleScabCalculations.ACCUMULATED_MILLS))); result.setValue(AppleScabCalculations.TM, String.valueOf(this.calculations.getParamDoubleValueForDate(timeStamp, AppleScabCalculations.TM))); result.setValue(AppleScabCalculations.BT, String.valueOf(this.calculations.getParamDoubleValueForDate(timeStamp, AppleScabCalculations.BT))); @@ -134,7 +134,7 @@ public class AppleScabModel extends I18nImpl implements Model{ { return Result.WARNING_STATUS_NO_WARNING; } - else if(this.calculations.getParamDoubleValueForDate(timeStamp, AppleScabCalculations.ASCOSPORE_MATURITY) == 100d) + else if(this.calculations.getParamDoubleValueForDate(this.weatherUtil.normalizeToExactDate(timeStamp, this.timeZone), AppleScabCalculations.ASCOSPORE_MATURITY) == 100d) { return Result.WARNING_STATUS_NO_WARNING; } @@ -347,8 +347,12 @@ public class AppleScabModel extends I18nImpl implements Model{ { currentAppleScabStadium = APPLE_SCAB_STADIUM_CONIDIA; } - ascosporeMaturity = ascosporeMaturityTable.getAscosporeMaturity(this.getAccumulatedTemperature(currentTimeStamp)); - this.calculations.setParamDoubleValueForDate(currentTimeStamp, AppleScabCalculations.ASCOSPORE_MATURITY, ascosporeMaturity); + // We update and store the ascospore maturity only at midnight, when we have an updated accumulated temperature + if(currentTimeStamp.equals(this.weatherUtil.normalizeToExactDate(currentTimeStamp, this.timeZone))) + { + ascosporeMaturity = ascosporeMaturityTable.getAscosporeMaturity(this.getAccumulatedTemperature(currentTimeStamp)); + this.calculations.setParamDoubleValueForDate(currentTimeStamp, AppleScabCalculations.ASCOSPORE_MATURITY, ascosporeMaturity); + } // We accumulate Mills only when there are humid conditions if(this.getLeafWetness(currentTimeStamp) < LEAF_WETNESS_THRESHOLD)