Click or drag to resize

DatedDataSpec Class

Defines a specification for a set of dated data such as daily, weekly, or monthly degree days covering a specific period in time.
Inheritance Hierarchy

Namespace:  DegreeDays.Api.Data
Assembly:  DegreeDays (in DegreeDays.dll) Version: 1.3
public sealed class DatedDataSpec : DataSpec

The DatedDataSpec type exposes the following members.

Public methodDatedDataSpec(Calculation, DatedBreakdown)
Constructs a DatedDataSpec object with the specified Calculation and DatedBreakdown.
Public propertyBreakdown
Gets the non-null DatedBreakdown object that defines the way in which the degree days should be broken down and the period in time that they should cover.
Public propertyCalculation
Gets the non-null Calculation object that defines the way in which the degree days should be calculated in terms of their base temperature and whether they should be heating degree days or cooling degree days.
Public methodEquals(Object)
Two DataSpec objects are equal if they have the same class and the same configuration.
(Inherited from DataSpec.)
Public methodGetHashCode
Overridden to ensure consistency with Equals.
(Inherited from DataSpec.)
Public methodToString
Returns a non-null, non-empty string representation of this instance for logging and debugging purposes.
(Overrides ObjectToString.)

A DatedDataSpec specifies a set of degree days in terms of:

  • its calculation process (heating or cooling, and the base temperature); and
  • its breakdown (e.g. daily, weekly, or monthly, and the period covered).

Example DatedDataSpec code:

Here's how you could specify monthly heating degree days with a base temperature of 15.5°C covering the whole of 2019:

DatedDataSpec datedDataSpec = DataSpec.Dated(
        new Day(2019, 1, 1).To(2019, 12, 31))));

You could then send that DatedDataSpec to the API as part of a LocationDataRequest, and get a response containing an DatedDataSet back:

DegreeDaysApi api = new DegreeDaysApi(new AccountKey(yourStringAccountKey),
    new SecurityKey(yourStringSecurityKey));
LocationDataRequest request = new LocationDataRequest(
    new DataSpecs(datedDataSpec));
LocationDataResponse response = api.DataApi.GetLocationData(request);
DatedDataSet datedData = response.DataSets.GetDated(datedDataSpec);
foreach (DatedDataValue v in datedData.Values) {
    Console.WriteLine(v.DayRange + ": " + v.Value);

To request multiple sets of dated data with different calculation processes (e.g. multiple different base temperatures) and/or different breakdowns, simply put multiple DatedDataSpec objects into the DataSpecs object that you pass into your LocationDataRequest.

Thread Safety
Instances of this class are immutable. You can safely reuse them and call them from multiple threads at once.
See Also