Skip to content
Snippets Groups Projects
Commit e641956b authored by Bhabesh Bhabani Mukhopadhyay's avatar Bhabesh Bhabani Mukhopadhyay
Browse files

avoid null in leaf wetness date calculation

to get a particular days leaf wetness remove possibility of null values of current and previous day 
parent 302c094e
No related branches found
No related tags found
No related merge requests found
...@@ -53,7 +53,6 @@ import no.nibio.vips.model.ConfigValidationException; ...@@ -53,7 +53,6 @@ import no.nibio.vips.model.ConfigValidationException;
import no.nibio.vips.model.Model; import no.nibio.vips.model.Model;
import no.nibio.vips.model.ModelExcecutionException; import no.nibio.vips.model.ModelExcecutionException;
import no.nibio.vips.model.ModelId; import no.nibio.vips.model.ModelId;
import no.nibio.vips.model.alternariamodel.bo.AltanariaWeatherBO;
import no.nibio.vips.util.ModelUtil; import no.nibio.vips.util.ModelUtil;
import no.nibio.vips.util.WeatherUtil; import no.nibio.vips.util.WeatherUtil;
...@@ -341,7 +340,7 @@ public class AlternariaModel extends I18nImpl implements Model{ ...@@ -341,7 +340,7 @@ public class AlternariaModel extends I18nImpl implements Model{
Date dateHourlyLw_previousDay = null; Date dateHourlyLw_previousDay = null;
int count = 0;
for(WeatherObservation weatherObj: observations) for(WeatherObservation weatherObj: observations)
{ {
...@@ -403,7 +402,7 @@ public class AlternariaModel extends I18nImpl implements Model{ ...@@ -403,7 +402,7 @@ public class AlternariaModel extends I18nImpl implements Model{
} }
dateHourlyTm_previousDay = dateHourlyTm_currentDay; dateHourlyTm_previousDay = dateHourlyTm_currentDay;
break; break;
...@@ -412,7 +411,11 @@ public class AlternariaModel extends I18nImpl implements Model{ ...@@ -412,7 +411,11 @@ public class AlternariaModel extends I18nImpl implements Model{
if(weatherObj.getLogIntervalId().equals(WeatherObservation.LOG_INTERVAL_ID_1H)) if(weatherObj.getLogIntervalId().equals(WeatherObservation.LOG_INTERVAL_ID_1H))
{ {
WeatherObservation altanariaWeatherBO_lw_hourly = weatherObj; WeatherObservation altanariaWeatherBO_lw_hourly = weatherObj;
if(dateHourlyLw_currentDay.after(dateHourlyLw_previousDay)) if(
null != dateHourlyLw_currentDay
&& null != dateHourlyLw_previousDay
&& dateHourlyLw_currentDay.after(dateHourlyLw_previousDay)
)
{ {
int counterLwHourly = 0; int counterLwHourly = 0;
for(WeatherObservation wo: altenariaWeatherLIstHourly_lw) for(WeatherObservation wo: altenariaWeatherLIstHourly_lw)
...@@ -423,18 +426,21 @@ public class AlternariaModel extends I18nImpl implements Model{ ...@@ -423,18 +426,21 @@ public class AlternariaModel extends I18nImpl implements Model{
} }
} }
dataMatrix.setParamIntValueForDate( dataMatrix.setParamIntValueForDate(
dateHourlyLw_currentDay dateHourlyLw_currentDay
, DataMatrix.LEAF_WETNESS_DURATION , DataMatrix.LEAF_WETNESS_DURATION
, counterLwHourly , counterLwHourly
); );
altenariaWeatherLIstHourly_lw = new ArrayList<WeatherObservation>(); altenariaWeatherLIstHourly_lw = new ArrayList<WeatherObservation>();
} }
altenariaWeatherLIstHourly_lw.add(altanariaWeatherBO_lw_hourly); altenariaWeatherLIstHourly_lw.add(altanariaWeatherBO_lw_hourly);
} }
dateHourlyLw_previousDay = dateHourlyLw_currentDay; dateHourlyLw_previousDay = dateHourlyLw_currentDay;
break; break;
} }
...@@ -464,8 +470,6 @@ public class AlternariaModel extends I18nImpl implements Model{ ...@@ -464,8 +470,6 @@ public class AlternariaModel extends I18nImpl implements Model{
*/ */
public int getDSV_DAILY(double temp, int lw ) public int getDSV_DAILY(double temp, int lw )
{ {
//if ((temp >= && temp < ) && (lw < )) dsvResult = ;
int dsvResult = 0; int dsvResult = 0;
if ((temp >= 10 && temp <= 17) && (lw <= 6)) dsvResult = 0; if ((temp >= 10 && temp <= 17) && (lw <= 6)) dsvResult = 0;
...@@ -496,7 +500,7 @@ public class AlternariaModel extends I18nImpl implements Model{ ...@@ -496,7 +500,7 @@ public class AlternariaModel extends I18nImpl implements Model{
} }
/** /**
* Get a trimmed date with out hour,minute,second,milli second * Get a trimmed date without hour,minute,second,milli second
* @param date * @param date
* @return * @return
*/ */
...@@ -513,7 +517,7 @@ public class AlternariaModel extends I18nImpl implements Model{ ...@@ -513,7 +517,7 @@ public class AlternariaModel extends I18nImpl implements Model{
} }
/** /**
* * Set DSV values to the DataMatrix in HashMap
* @param dataMatrix * @param dataMatrix
* @param tmDate * @param tmDate
* @param tmFlag * @param tmFlag
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment