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

Avoiding crash if we're very early in the season and we're

running out of soil temp (not forecasted)
parent 8c682b1c
Branches
No related tags found
1 merge request!1Master
...@@ -94,7 +94,10 @@ public class MamestraBrassicaeModel extends I18nImpl implements Model{ ...@@ -94,7 +94,10 @@ public class MamestraBrassicaeModel extends I18nImpl implements Model{
DecimalFormat dFormat = new DecimalFormat("###.##"); DecimalFormat dFormat = new DecimalFormat("###.##");
List<Result> retVal = new ArrayList<>(); List<Result> retVal = new ArrayList<>();
Calendar cal = Calendar.getInstance(timeZone); Calendar cal = Calendar.getInstance(timeZone);
while(currentDate.before(endDate)) while(currentDate.before(endDate)
// Stopping if we're running out of soil temp too early
&& !(accumulatedDayDegrees < THRESHOLD_TMDD_PUPAE && this.dataMatrix.getParamValueForDate(currentDate, DataMatrix.TJM10D) == null)
)
{ {
Double baseTemp = this.findT0(accumulatedDayDegrees); Double baseTemp = this.findT0(accumulatedDayDegrees);
Double todayTemp = accumulatedDayDegrees < THRESHOLD_TMDD_PUPAE ? Double todayTemp = accumulatedDayDegrees < THRESHOLD_TMDD_PUPAE ?
...@@ -318,7 +321,7 @@ public class MamestraBrassicaeModel extends I18nImpl implements Model{ ...@@ -318,7 +321,7 @@ public class MamestraBrassicaeModel extends I18nImpl implements Model{
this.dataMatrix.getFirstDateWithParameterValue(DataMatrix.TJM10D) + ", last day with air temp = " + this.dataMatrix.getFirstDateWithParameterValue(DataMatrix.TJM10D) + ", last day with air temp = " +
this.dataMatrix.getLastDateWithParameterValue(DataMatrix.TMD)); this.dataMatrix.getLastDateWithParameterValue(DataMatrix.TMD));
} }
//System.out.println(this.dataMatrix.toCSV());
} }
private Double findT0(Double accumulatedDayDegrees) private Double findT0(Double accumulatedDayDegrees)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment