Click or drag to resize

DayRangePeriodWithMinimumDayRange Method

Returns a new DayRangePeriod with the same DayRange as this, but also specifying minimumDayRange as the minimum range required.

Namespace: DegreeDays.Api.Data.Impl
Assembly: DegreeDays (in DegreeDays.dll) Version: 1.4
Syntax
public DayRangePeriod WithMinimumDayRange(
	DayRange minimumDayRange
)

Parameters

minimumDayRange  DayRange
The minimum range that the returned DayRangePeriod object should hold.

Return Value

DayRangePeriod
Exceptions
ExceptionCondition
ArgumentOutOfRangeExceptionminimumDayRange extends earlier or later than DayRange.
Remarks

A DayRangePeriod created through the constructor does not have a minimum range. Without a minimum range, the API can decide what to do if there is not enough data available to satisfy the DayRange, and it will typically return what it can from within DayRange. If this method is used to specify a minimum range, then a request for data will fail unless that minimum range can be satisfied.

The following example shows typical usage of this method:

DayRangePeriod period = 
    new DayRangePeriod(targetRange).WithMinimumDayRange(minimumRange);

Warning: be careful with minimum ranges, particularly when defining the last day of a minimum range. The degree days for any given day will never become available until the day has finished in the location's local time-zone, and it usually takes at least a few hours more for the required temperature data to filter through the system. For stations that don't record temperatures in the early morning (this explains the high "% estimated" figures of some minor airport stations), it can consistently take 10 or so hours for the previous day's data to become available, as our system needs a usable temperature reading from today before it will calculate the degree days from yesterday. Occasionally there can also be problems that can delay the appearance of fresh data further for certain stations, and delays of up to 10 or so days are possible, albeit rare. If your system specifies a minimum range that is too restrictive, it can easily end up with no data at all when in fact there's plenty of usable data available.

That said, there are times when a minimum range with highly-restrictive dates is exactly what you want (and you'd rather get nothing than slightly less data), so don't be afraid to specify restrictive minimum ranges if you need them.

See Also