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

Factoring out BT as optional weather parameter

parent f5eeee9a
No related branches found
No related tags found
No related merge requests found
...@@ -21,6 +21,8 @@ package no.nibio.vips.logic.scheduling.model.grid.preprocessor; ...@@ -21,6 +21,8 @@ package no.nibio.vips.logic.scheduling.model.grid.preprocessor;
import com.vividsolutions.jts.geom.Coordinate; import com.vividsolutions.jts.geom.Coordinate;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
...@@ -62,12 +64,25 @@ public class ZymoseptoriaSimpleRiskGridModelPreprocessor extends ModelRunPreproc ...@@ -62,12 +64,25 @@ public class ZymoseptoriaSimpleRiskGridModelPreprocessor extends ModelRunPreproc
List<WeatherObservation> stationObs = getStationObs(station, configuration); List<WeatherObservation> stationObs = getStationObs(station, configuration);
try try
{ {
stationObs = wUtil.checkForAndFixHourlyTimeSeriesHolesMultiParameter(stationObs, 6); // We need TM, UM and RR. BT is optional
List<WeatherObservation> mandatory = wUtil.filterWeatherObservationsByParameter(stationObs, new HashSet<>(Arrays.asList("TM","UM","RR")));
stationObs = wUtil.checkForAndFixHourlyTimeSeriesHolesMultiParameter(mandatory, 6);
} }
catch(WeatherObservationListException ex) catch(WeatherObservationListException ex)
{ {
throw new PreprocessorException(ex.getMessage()); throw new PreprocessorException("Problem with station #" + station.getPointOfInterestId() + ": " + ex.getMessage());
} }
// Checking for BT
try
{
List<WeatherObservation> BT = wUtil.filterWeatherObservationsByParameter(stationObs, new HashSet<>(Arrays.asList("BT")));
stationObs.addAll(wUtil.checkForAndFixHourlyTimeSeriesHoles(BT, 6));
}
catch(WeatherObservationListException ex)
{
}
PointWeatherObservationList pointObs = new PointWeatherObservationList(coordinate, stationObs, station.getTimeZone()); PointWeatherObservationList pointObs = new PointWeatherObservationList(coordinate, stationObs, station.getTimeZone());
allObs.add(pointObs); allObs.add(pointObs);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment