diff --git a/src/main/java/no/nibio/vips/util/weather/MetosAPIDataParser.java b/src/main/java/no/nibio/vips/util/weather/MetosAPIDataParser.java index e42cc6568e46a7d1c2ec5289d7ef7eb58e19c6a3..0a11e35fbe18eb6c0dbf9d18e8aeb3fb8b38a2b9 100644 --- a/src/main/java/no/nibio/vips/util/weather/MetosAPIDataParser.java +++ b/src/main/java/no/nibio/vips/util/weather/MetosAPIDataParser.java @@ -81,10 +81,10 @@ public class MetosAPIDataParser { new ParamInfo(WeatherElements.LEAF_WETNESS, new Integer[] {4}, "time"), new ParamInfo(WeatherElements.GLOBAL_RADIATION, new Integer[] {600}, "avg"), new ParamInfo(WeatherElements.WIND_SPEED_2M, new Integer[] {5}, "avg"), - new ParamInfo(WeatherElements.TEMPERATURE_MEAN, new Integer[] {16385}, "avg"), + new ParamInfo(WeatherElements.TEMPERATURE_MEAN, new Integer[] {0,16385}, "avg"), new ParamInfo(WeatherElements.TEMPERATURE_MAXIMUM, new Integer[] {16385}, "max"), new ParamInfo(WeatherElements.TEMPERATURE_MINIMUM, new Integer[] {16385}, "min"), - new ParamInfo(WeatherElements.RELATIVE_HUMIDITY_MEAN, new Integer[] {1,21778}, "avg") + new ParamInfo(WeatherElements.RELATIVE_HUMIDITY_MEAN, new Integer[] {1,507,21778}, "avg") }; @@ -245,7 +245,7 @@ public class MetosAPIDataParser { //System.out.println("Linje"); } - return this.getParsedObservations(all, this.getWeatherStationTimeZone(accessToken)); // TODO TimeZone + return this.getParsedObservations(all, this.getWeatherStationTimeZone(stationId, accessToken)); // TODO TimeZone } catch(IOException | ParseException | AuthenticationException ex) { @@ -253,9 +253,9 @@ public class MetosAPIDataParser { } } - private TimeZone getWeatherStationTimeZone(String accessToken) throws IOException + private TimeZone getWeatherStationTimeZone(String stationId,String accessToken) throws IOException { - HttpGet httpget = new HttpGet("https://api.fieldclimate.com/v1/station/000024A0"); + HttpGet httpget = new HttpGet("https://api.fieldclimate.com/v1/station/" + stationId); httpget.addHeader("Accept", "application/json"); httpget.addHeader("Authorization", "Bearer " + accessToken); CloseableHttpClient httpclient = HttpClients.createDefault(); diff --git a/src/test/java/no/nibio/vips/util/weather/MetosAPIDataParserTest.java b/src/test/java/no/nibio/vips/util/weather/MetosAPIDataParserTest.java index 555d900980222172c33838b0974bd35253b91c60..afeb9a16553379df4421a4b74806b1801096792b 100644 --- a/src/test/java/no/nibio/vips/util/weather/MetosAPIDataParserTest.java +++ b/src/test/java/no/nibio/vips/util/weather/MetosAPIDataParserTest.java @@ -70,7 +70,7 @@ public class MetosAPIDataParserTest { @Test public void testGetWeatherObservations() throws Exception { System.out.println("getWeatherObservations"); - String stationId = "000024A0"; + String stationId = "000012DE"; TimeZone timeZone = TimeZone.getTimeZone("Europe/Vilnius"); Calendar cal = Calendar.getInstance(); cal.setTimeZone(timeZone);