Class InfluxDbWeatherSource

java.lang.Object
edu.ie3.datamodel.io.source.influxdb.InfluxDbWeatherSource
All Implemented Interfaces:
DataSource, WeatherSource

public class InfluxDbWeatherSource extends Object implements WeatherSource
InfluxDB Source for weather data
  • Constructor Details

    • InfluxDbWeatherSource

      public InfluxDbWeatherSource(InfluxDbConnector connector, IdCoordinateSource coordinateSource, TimeBasedWeatherValueFactory weatherValueFactory)
      Initializes a new InfluxDbWeatherSource
      Parameters:
      connector - needed for database connection
      coordinateSource - needed to map coordinates to ID as InfluxDB does not support spatial types
      weatherValueFactory - 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 interface WeatherSource
      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 interface WeatherSource
      Parameters:
      timeInterval - Queried time interval
      coordinates - 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 interval
      coordinate - 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 interface WeatherSource
      Parameters:
      date - Queried date time
      coordinate - 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