Click or drag to resize

LocationDataRequest Class

Defines a request for one or more sets of degree-day data from a particular location.
Inheritance Hierarchy
SystemObject
  DegreeDays.ApiRequest
    DegreeDays.Api.DataLocationDataRequest

Namespace: DegreeDays.Api.Data
Assembly: DegreeDays (in DegreeDays.dll) Version: 1.4
Syntax
public sealed class LocationDataRequest : Request

The LocationDataRequest type exposes the following members.

Constructors
 NameDescription
Public methodLocationDataRequest Constructs a LocationDataRequest object with the specified Location and DataSpecs.
Top
Properties
 NameDescription
Public propertyDataSpecs Gets the non-null DataSpecs object that specifies how the set(s) of data should be calculated and broken down.
Public propertyLocation Gets the non-null Location object that specifies the location for which the degree days should be generated.
Top
Methods
 NameDescription
Public methodEquals Two LocationDataRequest objects are equal if it can be ascertained that they are specifying the same set(s) of data from the same location (i.e. they hold equal DataSpecs and Location objects).
(Overrides ObjectEquals(Object))
Public methodGetHashCode Overridden to ensure consistency with Equals.
(Overrides ObjectGetHashCode)
Public methodToString Returns a non-null, non-empty string representation of this instance for logging and debugging purposes.
(Overrides ObjectToString)
Top
Remarks

A successfully-processed LocationDataRequest will result in a LocationDataResponse containing the specified data.

Here's an example showing how to create a request for one set of data from the EGLL weather station in London, UK. The request specifies heating degree days with a base temperature of 15.5 C, broken down on a daily basis and covering the whole of July 2011:

Period period = Period.DayRange(new Day(2011, 7, 1).To(2011, 7, 31));
DatedBreakdown breakdown = DatedBreakdown.Daily(period);
Temperature baseTemp = Temperature.Celsius(15.5);
Calculation calculation = Calculation.HeatingDegreeDays(baseTemp);
DatedDataSpec dataSpec = DataSpec.Dated(calculation, breakdown);
Location location = Location.StationId("EGLL");
LocationDataRequest request = new LocationDataRequest(location, new DataSpecs(dataSpec));

Here's an example showing how to create a request for two sets of data from Times Square in New York. We specify the location as a zip code (a type of GeographicLocation), leaving it to the API to choose the most appropriate weather station in the area. The request specifies heating degree days with a base temperature of 55 F, and cooling degree days with a base temperature of 65 F, both broken down on a monthly basis and covering the last 12 months:

DatedBreakdown breakdown = DatedBreakdown.Monthly(Period.LatestValues(12));
DatedDataSpec hddSpec = DataSpec.Dated(
        Calculation.HeatingDegreeDays(Temperature.Fahrenheit(55)),
        breakdown);
DatedDataSpec cddSpec = DataSpec.Dated(
        Calculation.CoolingDegreeDays(Temperature.Fahrenheit(65)),
        breakdown);
LocationDataRequest request = new LocationDataRequest(
        Location.PostalCode("10036", "US"),
        new DataSpecs(hddSpec, cddSpec));

See DataApi for an example of how to submit a LocationDataRequest to the API and get a LocationDataResponse back containing the data you requested.

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