diff --git a/src/main/java/fi/luke/vips/model/cerealmodels/FinnCerealModels.java b/src/main/java/fi/luke/vips/model/cerealmodels/FinnCerealModels.java index 77e8de61184395289f16b014c3a6106b60674a16..61cfabba8ec625a5f5b1ab9088f36175e7bc8819 100644 --- a/src/main/java/fi/luke/vips/model/cerealmodels/FinnCerealModels.java +++ b/src/main/java/fi/luke/vips/model/cerealmodels/FinnCerealModels.java @@ -22,6 +22,7 @@ import no.nibio.vips.model.Model; import no.nibio.vips.model.ModelExcecutionException; import no.nibio.vips.model.ModelId; import no.nibio.vips.util.InvalidAggregationTypeException; +import no.nibio.vips.util.ModelUtil; import no.nibio.vips.util.WeatherObservationListException; import no.nibio.vips.util.WeatherUtil; @@ -345,12 +346,12 @@ public class FinnCerealModels extends I18nImpl implements Model { m.setTimeTillageEffects(b); } + ModelUtil modelUtil = new ModelUtil(); // weather information - ObjectMapper objectMapper = new ObjectMapper(); - List<WeatherObservation> temperature = objectMapper.convertValue(arg0.getConfigParameter("temperature"), new TypeReference<List<WeatherObservation>>(){}); - List<WeatherObservation> rainfall = objectMapper.convertValue(arg0.getConfigParameter("rainfall"), new TypeReference<List<WeatherObservation>>(){}); - List<WeatherObservation> rh = objectMapper.convertValue(arg0.getConfigParameter("rh"), new TypeReference<List<WeatherObservation>>(){}); - List<WeatherObservation> windSpeedAll = objectMapper.convertValue(arg0.getConfigParameter("windspeed"), new TypeReference<List<WeatherObservation>>(){}); + List<WeatherObservation> temperature = modelUtil.extractWeatherObservationList(arg0.getConfigParameter("temperature"));//objectMapper.convertValue(arg0.getConfigParameter("temperature"), new TypeReference<List<WeatherObservation>>(){}); + List<WeatherObservation> rainfall = modelUtil.extractWeatherObservationList(arg0.getConfigParameter("rainfall"));//objectMapper.convertValue(arg0.getConfigParameter("rainfall"), new TypeReference<List<WeatherObservation>>(){}); + List<WeatherObservation> rh = modelUtil.extractWeatherObservationList(arg0.getConfigParameter("rh"));//objectMapper.convertValue(arg0.getConfigParameter("rh"), new TypeReference<List<WeatherObservation>>(){}); + List<WeatherObservation> windSpeedAll = modelUtil.extractWeatherObservationList(arg0.getConfigParameter("windspeed"));//objectMapper.convertValue(arg0.getConfigParameter("windspeed"), new TypeReference<List<WeatherObservation>>(){}); WeatherUtil wu = new WeatherUtil(); // get average daily temperatures try {