Fetch nicely formatted individual station weather summaries from the DPIRD Weather 2.0 API.
Arguments
- station_code
A
character
string of the DPIRD station code for the station of interest. Station codes are available from theget_stations_metadata()
function.- start_date
A
character
string orDate
object representing the beginning of the range to query in the format “yyyy-mm-dd” (ISO8601). Data returned is inclusive of this date.- end_date
A
character
string orDate
object representing the end of the range query in the format “yyyy-mm-dd” (ISO8601). Data returned is inclusive of this date. Defaults to the current system date.- interval
A
character
string that indicates the time interval tomonthly
oryearly
. For intervals shorter than 1 day, the time period covered will be midnight to midnight, with the end_date time interval being before midnight - hour/minute values are for the end of the time period. Data for shorter intervals (15min
,30min
) are available from January of the previous year.- values
A
character
string with the type of summarised weather to return. See Available Values for a full list of valid values. Defaults toall
with all available values being returned.- include_closed
A
Boolean
value that defaults toFALSE
. If set toTRUE
the query returns closed and open stations. Closed stations are those that have been turned off and no longer report data. They may be useful for historical purposes. Only set toTRUE
to fetch data from closed stations.- api_key
A
character
string containing your API key from DPIRD, https://www.agric.wa.gov.au/web-apis, for the DPIRD Weather 2.0 API.
Value
a data.table with station_code
and the date interval
queried together with the requested weather variables in alphabetical
order. The first ten columns will always be:
station_code
,station_name
,longitude
,latitude
,year
,month
,day
,hour
,minute
, and ifmonth
or finer is present,date
(a combination of year, month, day, hour, minute as appropriate).
Note
Please note this function converts date-time columns from Coordinated Universal Time ‘UTC’ to Australian Western Standard Time ‘AWST’.
Column Name Details
Column names are converted from the default returns of the API to
be snake_case formatted and where appropriate, the names of the values
that are analogous between SILO and DPIRD data are
named using the same name for ease of interoperability, e.g., using
rbind()
to create a data.table
that contains data from both APIs.
However, use with caution and don't mix datasets of different time-steps,
i.e., this function gets many summary values not just “daily”
time-step data. The functions that access the SILO
API only provide access to daily data, so don't mix (sub)hourly,
monthly or yearly data from DPIRD with SILO.
Available Values
all (which will return all of the following values),
airTemperature,
airTemperatureAvg,
airTemperatureMax,
airTemperatureMaxTime,
airTemperatureMin,
airTemperatureMinTime,
apparentAirTemperature,
apparentAirTemperatureAvg,
apparentAirTemperatureMax,
apparentAirTemperatureMaxTime,
apparentAirTemperatureMin,
apparentAirTemperatureMinTime,
barometricPressure,
barometricPressureAvg,
barometricPressureMax,
barometricPressureMaxTime,
barometricPressureMin,
barometricPressureMinTime,
battery,
batteryMinVoltage,
batteryMinVoltageDateTime,
chillHours,
deltaT,
deltaTAvg,
deltaTMax,
deltaTMaxTime,
deltaTMin,
deltaTMinTime,
dewPoint,
dewPointAvg,
dewPointMax,
dewPointMaxTime,
dewPointMin,
dewPointMinTime,
erosionCondition,
erosionConditionMinutes,
erosionConditionStartTime,
errors,
evapotranspiration,
evapotranspirationShortCrop,
evapotranspirationTallCrop,
frostCondition,
frostConditionMinutes,
frostConditionStartTime,
heatCondition,
heatConditionMinutes,
heatConditionStartTime,
observations,
observationsCount,
observationsPercentage,
panEvaporation,
rainfall,
relativeHumidity,
relativeHumidityAvg,
relativeHumidityMax,
relativeHumidityMaxTime,
relativeHumidityMin,
relativeHumidityMinTime,
richardsonUnits,
soilTemperature,
soilTemperatureAvg,
soilTemperatureMax,
soilTemperatureMaxTime,
soilTemperatureMin,
soilTemperatureMinTime,
solarExposure,
wetBulb,
wetBulbAvg,
wetBulbMax,
wetBulbMaxTime,
wetBulbMin,
wetBulbMinTime,
wind,
windAvgSpeed, and
windMaxSpeed
See also
Other DPIRD:
dpird_extreme_weather_values
,
dpird_minute_values
,
dpird_summary_values
,
find_nearby_stations()
,
get_dpird_apsim()
,
get_dpird_availability()
,
get_dpird_extremes()
,
get_dpird_minute()
,
get_stations_metadata()
Other data fetching:
get_ag_bulletin()
,
get_coastal_forecast()
,
get_data_drill()
,
get_data_drill_apsim()
,
get_dpird_apsim()
,
get_dpird_extremes()
,
get_dpird_minute()
,
get_patched_point()
,
get_patched_point_apsim()
,
get_precis_forecast()
,
get_radar_imagery()
,
get_satellite_imagery()
Author
Adam H. Sparks, adamhsparks@gmail.com, and Rodrigo Pires, rodrigo.pires@dpird.wa.gov.au
Examples
if (FALSE) {
# Note that you need to supply your own API key
# Use default for end date (current system date) to get rainfall
wd <- get_dpird_summaries(
station_code = "CL001",
start_date = "20171028",
api_key = "your_api_key",
interval = "yearly",
values = "rainfall"
)
# Only for wind and erosion conditions for daily time interval
wd <- get_dpird_summaries(
station_code = "BI",
start_date = "20220501",
end_date = "20220502",
api_key = "your_api_key",
interval = "daily",
values = c(
"wind",
"erosionCondition",
"erosionConditionMinutes",
"erosionConditionStartTime"
)
)
}