public final class SourceDataException extends FailureException
Failure
to generate a DataSet
caused by problems
with the source temperature data for the Location
and Period
requested.
For a LocationDataRequest
containing specifications for multiple sets
of data, it is possible for some to succeed and others to fail if they are
sufficiently different (e.g. covering different periods in time).
This exception corresponds to any failure code starting with "SourceData".
You can interrogate the
isDueToXXX()
methods of this exception to find out more
about the cause. But do note that it is possible for none of those methods to
return true
if a relevant new failure code is added into the API. Be
prepared for this in your handling.
Instances of this class are immutable. You can safely reuse them and call them from multiple threads at once.
Modifier and Type | Method and Description |
---|---|
boolean |
isDueToSourceDataCoverage()
Returns
true if the requested data could not be generated
because the source weather station's recorded temperature data did not
cover the requested period in time. |
boolean |
isDueToSourceDataErrors()
Returns
true if the requested data could not be generated
because of errors in the recorded temperature data of the source weather
station. |
boolean |
isDueToSourceDataGranularity()
Returns
true if the requested data could not be generated
because the source weather station's recorded temperature data was not
fine-grained/detailed enough. |
failure, getMessage
public boolean isDueToSourceDataErrors()
true
if the requested data could not be generated
because of errors in the recorded temperature data of the source weather
station.
Generally speaking, if a request for data from a weather station results in this error, it is probably best to find an alternative weather station nearby. But a weather station with data errors is not necessarily totally useless - it may make a revival at some point in the future, and it's possible that data requests covering a different period in time will work OK.
isDueToXXX()
methodspublic boolean isDueToSourceDataCoverage()
true
if the requested data could not be generated
because the source weather station's recorded temperature data did not
cover the requested period in time.
This will arise if you request data too early (because the weather station hasn't yet recorded the necessary temperature readings or they haven't yet filtered into our system), or if the weather station didn't exist or wasn't recording for the requested period in time.
isDueToXXX()
methodspublic boolean isDueToSourceDataGranularity()
true
if the requested data could not be generated
because the source weather station's recorded temperature data was not
fine-grained/detailed enough.
This will arise if you request detailed time-series data (e.g. hourly temperature data) for a station without sufficiently fine-grained weather reports.
isDueToXXX()
methods
See www.degreedays.net/api/ for more about the Degree Days.net API.
You can sign up for a Degree Days.net API account and read the integration guide that is useful and applicable whether you are using Java or not.