Fetch nicely formatted minute weather station data from the DPIRD Weather 2.0 API for a maximum 24-hour period.
Arguments
- station_code
A
character
string orfactor
fromget_stations_metadata()
of the BOM station code for the station of interest.- start_date_time
A
character
string representing the start date and time of the query in the format “yyyy-mm-dd-hh-mm” (ISO8601). Defaults to 24 hours before the current local system time, returning the most recent 24 hour observations rounded to the nearest minute. This function does its best to decipher many date and time formats but prefers ISO8601.- minutes
An
integer
value that provides the number of observations to be returned. Defaults to 1440 minutes for 24 hours of observations.- values
A
vector
of weather values to query from the API. See Available Values section for valid available codes. Defaults to all available values,all
.- 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. Defaults to automatically detecting your key from your local .Renviron, .Rprofile or similar. Alternatively, you may directly provide your key as a string here. If nothing is provided, you will be prompted on how to set up your R session so that it is auto-detected.
Value
a data.table::data.table()
with station_code
and the date interval
queried together with the requested weather variables.
Note
Please note this function converts date-time columns from Coordinated Universal Time ‘UTC’ returned by the API to Australian Western Standard Time ‘AWST’.
Available Values
all (which will return all of the following values),
airTemperature,
dateTime,
dewPoint,
rainfall,
relativeHumidity,
soilTemperature,
solarIrradiance,
wetBulb,
wind,
windAvgSpeed,
windMaxSpeed, and
windMinSpeed
See also
Other DPIRD:
dpird_extreme_weather_values
,
dpird_minute_values
,
dpird_summary_values
,
find_nearby_stations()
,
find_stations_in()
,
get_dpird_apsim()
,
get_dpird_availability()
,
get_dpird_extremes()
,
get_dpird_summaries()
,
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_summaries()
,
get_patched_point()
,
get_patched_point_apsim()
,
get_precis_forecast()
,
get_radar_imagery()
,
get_satellite_imagery()
Author
Adam H. Sparks, adamhsparks@gmail.com
Examples
if (FALSE) { # \dontrun{
# Note that you need to supply your own API key
get_dpird_minute(
station_code = "SP",
start_date_time = "2023-02-01 13:00:00",
minutes = 1440,
values = c("airTemperature",
"solarIrradiance",
"wind"),
api_key = "your_api_key"
)
} # }