Class InfluxDbWeatherSource
java.lang.Object
edu.ie3.datamodel.io.source.influxdb.InfluxDbWeatherSource
- All Implemented Interfaces:
DataSource
,WeatherSource
InfluxDB Source for weather data
-
Constructor Summary
ConstructorDescriptionInfluxDbWeatherSource
(InfluxDbConnector connector, IdCoordinateSource coordinateSource, TimeBasedWeatherValueFactory weatherValueFactory) Initializes a new InfluxDbWeatherSource -
Method Summary
Modifier and TypeMethodDescriptionprotected Stream<TimeBasedValue<WeatherValue>>
filterEmptyOptionals
(Stream<Optional<TimeBasedValue<WeatherValue>>> elements) Removes empty OptionalsMap<org.locationtech.jts.geom.Point,
IndividualTimeSeries<WeatherValue>> getWeather
(edu.ie3.util.interval.ClosedInterval<ZonedDateTime> timeInterval) Return the weather for the given time intervalMap<org.locationtech.jts.geom.Point,
IndividualTimeSeries<WeatherValue>> getWeather
(edu.ie3.util.interval.ClosedInterval<ZonedDateTime> timeInterval, Collection<org.locationtech.jts.geom.Point> coordinates) Return the weather for the given time interval AND coordinatesgetWeather
(edu.ie3.util.interval.ClosedInterval<ZonedDateTime> timeInterval, org.locationtech.jts.geom.Point coordinate) Return the weather for the given time interval AND coordinategetWeather
(ZonedDateTime date, org.locationtech.jts.geom.Point coordinate) Return the weather for the given time date AND coordinate
-
Constructor Details
-
InfluxDbWeatherSource
public InfluxDbWeatherSource(InfluxDbConnector connector, IdCoordinateSource coordinateSource, TimeBasedWeatherValueFactory weatherValueFactory) Initializes a new InfluxDbWeatherSource- Parameters:
connector
- needed for database connectioncoordinateSource
- needed to map coordinates to ID as InfluxDB does not support spatial typesweatherValueFactory
- instance of a time based weather value factory
-
-
Method Details
-
getWeather
public Map<org.locationtech.jts.geom.Point,IndividualTimeSeries<WeatherValue>> getWeather(edu.ie3.util.interval.ClosedInterval<ZonedDateTime> timeInterval) Description copied from interface:WeatherSource
Return the weather for the given time interval- Specified by:
getWeather
in interfaceWeatherSource
- Parameters:
timeInterval
- Queried time interval- Returns:
- weather data for the specified time range, sorted by coordinate
-
getWeather
public Map<org.locationtech.jts.geom.Point,IndividualTimeSeries<WeatherValue>> getWeather(edu.ie3.util.interval.ClosedInterval<ZonedDateTime> timeInterval, Collection<org.locationtech.jts.geom.Point> coordinates) Description copied from interface:WeatherSource
Return the weather for the given time interval AND coordinates- Specified by:
getWeather
in interfaceWeatherSource
- Parameters:
timeInterval
- Queried time intervalcoordinates
- Queried coordinates- Returns:
- weather data for the specified time range and coordinates, sorted by coordinate
-
getWeather
public IndividualTimeSeries<WeatherValue> getWeather(edu.ie3.util.interval.ClosedInterval<ZonedDateTime> timeInterval, org.locationtech.jts.geom.Point coordinate) Return the weather for the given time interval AND coordinate- Parameters:
timeInterval
- Queried time intervalcoordinate
- Queried coordinate- Returns:
- weather data for the specified time and coordinate
-
getWeather
public Optional<TimeBasedValue<WeatherValue>> getWeather(ZonedDateTime date, org.locationtech.jts.geom.Point coordinate) Description copied from interface:WeatherSource
Return the weather for the given time date AND coordinate- Specified by:
getWeather
in interfaceWeatherSource
- Parameters:
date
- Queried date timecoordinate
- Queried coordinate- Returns:
- weather data for the specified time and coordinate
-
filterEmptyOptionals
protected Stream<TimeBasedValue<WeatherValue>> filterEmptyOptionals(Stream<Optional<TimeBasedValue<WeatherValue>>> elements) Removes empty Optionals- Parameters:
elements
- stream to filter- Returns:
- filtered elements Stream
-