diff --git a/src/main/java/no/nibio/vips/logic/modules/roughage/RoughageService.java b/src/main/java/no/nibio/vips/logic/modules/roughage/RoughageService.java index cfe05d635f1d1905a2e17de9ada75aefcbefc266..c8cd224ac8b10bc85198d61f974bcf2cdd017217 100755 --- a/src/main/java/no/nibio/vips/logic/modules/roughage/RoughageService.java +++ b/src/main/java/no/nibio/vips/logic/modules/roughage/RoughageService.java @@ -369,6 +369,12 @@ public class RoughageService { Organization org = em.find(Organization.class, organizationId); Integer VIPSCoreUserId = org.getDefaultVipsCoreUserId(); + /*System.out.println("Antall ordinære værdata: " + observations.size()); + for(WeatherObservation obs:observations) + { + System.out.println(obs.toString()); + }*/ + List<Result> results; try { @@ -376,6 +382,7 @@ public class RoughageService { } catch(RunModelException ex) { + //System.out.println("Feilen skjer med ordinære værdata"); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(ex.getMessage()).build(); } // NORMALDATA @@ -402,6 +409,10 @@ public class RoughageService { latestObsDate ); + // The observations are tainted with the _NORMAL prefix, must clean up + // before sending to model + observations.stream().forEach(obs->obs.setElementMeasurementTypeId(obs.getElementMeasurementTypeId().substring(0, obs.getElementMeasurementTypeId().indexOf("_NORMAL")))); + // Add waterings to normal data precipitation? if( wateringAffectsNormalData != null && wateringAffectsNormalData.equals("true") @@ -418,6 +429,7 @@ public class RoughageService { //System.out.println("Old: " + obs.getValue() + ", new: " + (obs.getValue() + wateringMap.get(obs.getTimeMeasured()))); obs.setValue(obs.getValue() + wateringMap.get(obs.getTimeMeasured())); } + } } /*System.out.println("Antall normaldata: " + observations.size()); diff --git a/src/main/java/no/nibio/vips/logic/scheduling/model/preprocessor/FinnCerealModelsPreprocessor.java b/src/main/java/no/nibio/vips/logic/scheduling/model/preprocessor/FinnCerealModelsPreprocessor.java index 790d467bb0fe60f94a173561336098e7bdf480bd..d648ac9f093e615a3665ae430e2adbe418c5f032 100644 --- a/src/main/java/no/nibio/vips/logic/scheduling/model/preprocessor/FinnCerealModelsPreprocessor.java +++ b/src/main/java/no/nibio/vips/logic/scheduling/model/preprocessor/FinnCerealModelsPreprocessor.java @@ -2,10 +2,7 @@ package no.nibio.vips.logic.scheduling.model.preprocessor; import java.text.ParseException; import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Arrays; import java.util.Date; -import java.util.HashSet; import java.util.List; import java.util.stream.Collectors; @@ -15,7 +12,6 @@ import no.nibio.vips.logic.entity.ForecastConfiguration; import no.nibio.vips.logic.entity.PointOfInterestWeatherStation; import no.nibio.vips.logic.scheduling.model.ModelRunPreprocessor; import no.nibio.vips.logic.scheduling.model.PreprocessorException; -import no.nibio.vips.model.ConfigValidationException; import no.nibio.vips.util.WeatherElements; import no.nibio.vips.util.WeatherObservationListException; import no.nibio.vips.util.WeatherUtil; diff --git a/src/main/java/no/nibio/vips/util/weather/WeatherDataSourceUtil.java b/src/main/java/no/nibio/vips/util/weather/WeatherDataSourceUtil.java index 3e94f1becf4cb2ed3391df2cce4e124fd890433f..e79b30a8169d8e02191051c01225b65059a437fc 100755 --- a/src/main/java/no/nibio/vips/util/weather/WeatherDataSourceUtil.java +++ b/src/main/java/no/nibio/vips/util/weather/WeatherDataSourceUtil.java @@ -189,6 +189,7 @@ public class WeatherDataSourceUtil { URLOutput = IOUtils.toString(URLStream); List<WeatherObservation> preliminaryResult = this.getWeatherObservations(URLOutput); List<WeatherObservation> filteredObservations = new ArrayList<>(); + //System.out.println(this.getClass().getName() + "/preliminaryResult.size()=" + preliminaryResult.size()); preliminaryResult.stream().filter((candidateObs) -> ( candidateObs.getLogIntervalId().equals(logIntervalId) && Arrays.asList(elementMeasurementTypes).contains(candidateObs.getElementMeasurementTypeId()) @@ -196,6 +197,7 @@ public class WeatherDataSourceUtil { ).forEachOrdered((candidateObs) -> { filteredObservations.add(candidateObs); }); + //System.out.println(this.getClass().getName() + "/filteredObservations.size()=" + filteredObservations.size()); return filteredObservations; } catch (IOException ex) { StringBuilder errorMessage = new StringBuilder().append("Could not fetch weather observations from URI ").append(URL.toString()).append(".\n");