net.degreedays.api.data
Class TimeSeriesCalculation

java.lang.Object
  extended by net.degreedays.api.data.TimeSeriesCalculation
Direct Known Subclasses:
TemperatureTimeSeriesCalculation

public abstract class TimeSeriesCalculation
extends java.lang.Object

Defines how time-series data should be calculated e.g. temperature data, with hourly figures, in Celsius.

To create a TimeSeriesCalculation object you can use the static factory methods of this class. For example:

 TimeSeriesCalculation hourlyTempsCalculation = 
     TimeSeriesCalculation.hourlyTemperature(TemperatureUnit.CELSIUS);
 

The docs for TimeSeriesDataSpec have more on how to actually fetch time-series data with your specified TimeSeriesCalculation.

Why is time-series data "calculated"?

You might wonder why time-series data such as hourly temperature data is "calculated" as opposed to just being returned...

The thing is that real-world weather stations hardly ever report exactly on the hour, every hour. Different stations have different reporting frequencies and schedules, they can change over time (e.g. if a station has its equipment upgraded), and gaps in routine reporting are fairly common too. Higher-quality stations do tend to report at least hourly, but it's rarely exactly on the hour, and it's rarely perfectly regular either. We take whatever data the weather stations do report, and use it to calculate (or interpolate) neat, perfectly-regular time-series data (such as hourly temperature data) with all gaps filled with estimated data (which is marked as such so you can easily identify it).

The end result is neat, regular data that is easy to store and easy to work with, but it actually takes a lot of processing to get it into that format. And this is why time-series data from our system is "calculated" as opposed to just being returned.

Since:
1.2
See Also:
TimeSeriesDataSpec

This abstract class is not designed to be extended by third-party code, which is why it does not have an accessible constructor.

All concrete subclasses of this abstract class are immutable. You can safely reuse them and call them from multiple threads at once.


Method Summary
 boolean equals(java.lang.Object o)
          Two TimeSeriesCalculation objects are equal if they have the same class and the same configuration.
 int hashCode()
          Overridden to ensure consistency with equals.
static TemperatureTimeSeriesCalculation hourlyTemperature(TemperatureUnit temperatureUnit)
          Returns a non-null TemperatureTimeSeriesCalculation object with TimeSeriesInterval.HOURLY and the specified TemperatureUnit.
 TimeSeriesInterval interval()
          Returns the non-null TimeSeriesInterval indicating the interval (e.g. hourly) that the time-series data should be calculated with.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

interval

public TimeSeriesInterval interval()
Returns the non-null TimeSeriesInterval indicating the interval (e.g. hourly) that the time-series data should be calculated with.


hourlyTemperature

public static TemperatureTimeSeriesCalculation hourlyTemperature(TemperatureUnit temperatureUnit)
Returns a non-null TemperatureTimeSeriesCalculation object with TimeSeriesInterval.HOURLY and the specified TemperatureUnit.

Parameters:
temperatureUnit - specifies whether the data should be calculated in Celsius or Fahrenheit. Cannot be null.
Throws:
java.lang.NullPointerException - if temperatureUnit is null.

equals

public final boolean equals(java.lang.Object o)
Two TimeSeriesCalculation objects are equal if they have the same class and the same configuration.

Overrides:
equals in class java.lang.Object

hashCode

public final int hashCode()
Overridden to ensure consistency with equals.

Overrides:
hashCode in class java.lang.Object


www.degreedays.net/api/