diff --git a/src/main/java/no/nibio/vips/logic/controller/session/SchedulingBean.java b/src/main/java/no/nibio/vips/logic/controller/session/SchedulingBean.java index 2e8922cc3d4c78aa4e461e709b68d81e263aa8d1..311c368eb07d7f21fb0b276ca5230f9e3a5b80d7 100755 --- a/src/main/java/no/nibio/vips/logic/controller/session/SchedulingBean.java +++ b/src/main/java/no/nibio/vips/logic/controller/session/SchedulingBean.java @@ -449,7 +449,7 @@ public class SchedulingBean { " failed at + " + taskExecutor.getStartTime() + ", finished at " + new Date() + ". Status is " + taskHistory.getTaskHistoryStatusId() + - ". Error was " + taskHistory.getMessage().substring(0,400) + "[...]" + + ". Error was " + taskHistory.getMessage().substring(0, Math.min(400, taskHistory.getMessage().length())) + "[...]" + " ############"); } diff --git a/src/main/java/no/nibio/vips/logic/scheduling/model/preprocessor/AppleScabModelPreprocessor.java b/src/main/java/no/nibio/vips/logic/scheduling/model/preprocessor/AppleScabModelPreprocessor.java index 58829987f76de518a5597d6a7a6bfbacb4c5d016..4de8ad02e8880b4c2701fc7623314fe42f6dd3ee 100755 --- a/src/main/java/no/nibio/vips/logic/scheduling/model/preprocessor/AppleScabModelPreprocessor.java +++ b/src/main/java/no/nibio/vips/logic/scheduling/model/preprocessor/AppleScabModelPreprocessor.java @@ -249,7 +249,7 @@ public class AppleScabModelPreprocessor extends ModelRunPreprocessor{ //System.out.println(wUtil.dumpWeatherObservationList(RR)); } - BT = wUtil.checkForAndFixHourlyTimeSeriesHoles(BT); + // Unequal length of lists if ( @@ -267,25 +267,6 @@ public class AppleScabModelPreprocessor extends ModelRunPreprocessor{ // Fallback if missing leaf wetness: If we have relative humidity. leaf wetness may be calculated if(BT.size() != TM.size() && UM.size() == TM.size()) { - Q0 = wUtil.fixHourlyValuesForParameters( - Q0, - new HashSet(Arrays.asList("Q0")), - firstTimeStamp, - null - ); - FM2 = wUtil.fixHourlyValuesForParameters( - FM2, - new HashSet(Arrays.asList("FM2")), - firstTimeStamp, - null - ); - - BT = wUtil.fixHourlyValuesForParameters( - BT, - new HashSet(Arrays.asList("BT")), - firstTimeStamp, - null - ); BT = wUtil.calculateLeafWetnessHourSeriesBestEffort(BT,TM, RR, Q0, FM2, UM); if(BT.size() != TM.size()) diff --git a/src/main/java/no/nibio/vips/logic/scheduling/model/preprocessor/NaerstadModelPreprocessor.java b/src/main/java/no/nibio/vips/logic/scheduling/model/preprocessor/NaerstadModelPreprocessor.java index e1199dc2fc2ac04104a2ad2f60850908566c4b86..ce971de0b628c9c4de8366f418e4b863bcaf8eb7 100755 --- a/src/main/java/no/nibio/vips/logic/scheduling/model/preprocessor/NaerstadModelPreprocessor.java +++ b/src/main/java/no/nibio/vips/logic/scheduling/model/preprocessor/NaerstadModelPreprocessor.java @@ -210,7 +210,7 @@ public class NaerstadModelPreprocessor extends ModelRunPreprocessor{ // Problems with weather observations //System.out.println("BT=" + BT.size() + " [First=," + BT.get(0).getTimeMeasured() + " last=" + BT.get(BT.size()-1).getTimeMeasured() + "]"); - BT = wUtil.checkForAndFixHourlyTimeSeriesHoles(BT); + //BT = wUtil.checkForAndFixHourlyTimeSeriesHoles(BT); // Unequal length of lists if ( diff --git a/src/main/java/no/nibio/vips/logic/service/WeatherProxyService.java b/src/main/java/no/nibio/vips/logic/service/WeatherProxyService.java index 4f91248f398f8998233260616d2f2e6f25260ed3..a42071b41fd418f952c5542ec9a57c2e28d91d9d 100755 --- a/src/main/java/no/nibio/vips/logic/service/WeatherProxyService.java +++ b/src/main/java/no/nibio/vips/logic/service/WeatherProxyService.java @@ -99,7 +99,7 @@ public class WeatherProxyService { @Path("fmi/{stationId}") @GZIP @Produces("application/json;charset=UTF-8") - public Response getMetosRIMProWeatherData( + public Response getFMIVIPSWeatherData( @PathParam("stationId") String stationId, @FormParam("timeZone") String timeZonePOST, @QueryParam("timeZone") String timeZoneGET, @@ -109,7 +109,7 @@ public class WeatherProxyService { @QueryParam("endDate") String endDateGET ) { - String FMI_URL_TEMPLATE="http://www.cropinfra.com:8080/weather/resources/fmi/temporal/vips/{0}/{1}/{2}"; + String FMI_URL_TEMPLATE="http://192.194.211.203/weather/resources/fmi/temporal/vips/{0}/{1}/{2}"; List<WeatherObservation> observations; try { 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 e79b30a8169d8e02191051c01225b65059a437fc..80590d551441905b0d5150d00b78d3ea24d19c5b 100755 --- a/src/main/java/no/nibio/vips/util/weather/WeatherDataSourceUtil.java +++ b/src/main/java/no/nibio/vips/util/weather/WeatherDataSourceUtil.java @@ -24,6 +24,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import java.io.IOException; import java.io.InputStream; import java.net.HttpURLConnection; +import java.net.SocketTimeoutException; import java.net.URL; import java.net.URLConnection; import java.text.SimpleDateFormat; @@ -181,10 +182,15 @@ public class WeatherDataSourceUtil { InputStream URLStream = null; InputStream error = null; String URLOutput; + int connectTimeout = 30; + int readTimeout = 120; try { URL weatherURL = new URL(URL.toString()); //System.out.println("URL=" + weatherURL); URLConn = weatherURL.openConnection(); + + URLConn.setConnectTimeout(1000 * connectTimeout); // If weather data server does not reply in 30 seconds, abort + URLConn.setReadTimeout(1000 * readTimeout); // If weather data server is not done delivering the data in two minutes, abort URLStream = URLConn.getInputStream(); URLOutput = IOUtils.toString(URLStream); List<WeatherObservation> preliminaryResult = this.getWeatherObservations(URLOutput); @@ -207,6 +213,10 @@ public class WeatherDataSourceUtil { errorOutput = IOUtils.toString(error); } catch (IOException | NullPointerException ex2) { } + if(ex instanceof SocketTimeoutException) + { + errorMessage.append("The weather data server is deemed unresponsive. The connection times out after " + connectTimeout + " seconds of no reply and " + readTimeout + " seconds of no data received after established connection.\n"); + } if (errorOutput.isEmpty()) { errorMessage.append("There was no output from weather data server to explain this."); } else {