Skip to contents

Fetch nicely formatted individual extreme weather summaries from the DPIRD Weather 2.0 API.

Usage

get_dpird_extremes(
  station_code,
  values = "all",
  api_key = get_key(service = "DPIRD")
)

Arguments

station_code

A character string or factor from get_stations_metadata() of the BOM station code for the station of interest.

values

A character string with the type of extreme weather to return. See Available Values for a full list of valid values. Defaults to all, returning the full list of values unless otherwise specified.

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() of one row with station_code, station_name, latitude, longitude, date_time of the query and the extreme weather information according to the value(s) selected.

Available Values

  • all (which will return all of the following values),

  • erosionCondition,

  • erosionConditionLast7Days,

  • erosionConditionLast7DaysDays,

  • erosionConditionLast7DaysMinutes,

  • erosionConditionLast14Days,

  • erosionConditionLast14DaysDays,

  • erosionConditionLast14DaysMinutes,

  • erosionConditionMonthToDate,

  • erosionConditionMonthToDateDays,

  • erosionConditionMonthToDateMinutes,

  • erosionConditionMonthToDateStartTime,

  • erosionConditionSince12AM,

  • erosionConditionSince12AMMinutes,

  • erosionConditionSince12AMStartTime,

  • erosionConditionYearToDate,

  • erosionConditionYearToDateDays,

  • erosionConditionYearToDateMinutes,

  • erosionConditionYearToDateStartTime,

  • frostCondition,

  • frostConditionLast7Days,

  • frostConditionLast7DaysDays,

  • frostConditionLast7DaysMinutes,

  • frostConditionLast14Days,

  • frostConditionLast14DaysDays,

  • frostConditionLast14DaysMinutes,

  • frostConditionMonthToDate,

  • frostConditionMonthToDateDays,

  • frostConditionMonthToDateMinutes,

  • frostConditionMonthToDateStartTime,

  • frostConditionSince9AM,

  • frostConditionSince9AMMinutes,

  • frostConditionSince9AMStartTime,

  • frostConditionTo9AM,

  • frostConditionTo9AMMinutes,

  • frostConditionTo9AMStartTime,

  • frostConditionYearToDate,

  • frostConditionYearToDate,

  • frostConditionYearToDateMinutes,

  • frostConditionYearToDateStartTime,

  • heatCondition,

  • heatConditionLast7Days,

  • heatConditionLast7DaysDays,

  • heatConditionLast7DaysMinutes,

  • heatConditionLast14Days,

  • heatConditionLast14DaysDays,

  • heatConditionLast14DaysMinutes,

  • heatConditionMonthToDate,

  • heatConditionMonthToDateDays,

  • heatConditionMonthToDateMinutes,

  • heatConditionMonthToDateStartTime,

  • heatConditionSince12AM,

  • heatConditionSince12AMMinutes,

  • heatConditionSince12AMStartTime,

  • heatConditionYearToDate,

  • heatConditionYearToDateDays,

  • heatConditionYearToDateMinutes, and

  • heatConditionYearToDateStartTime

Author

Rodrigo Pires, rodrigo.pires@dpird.wa.gov.au, and Adam Sparks, adamhsparks@gmail.com

Examples

if (FALSE) { # \dontrun{
# Query Bonnie Rock station for wind erosion and heat extreme events
# Note that you need to supply your own API key

xtreme <- get_dpird_extremes(
  station_code = "BR",
  values = c("erosionCondition",
           "heatCondition"),
  api_key = "your_api_key"
)
} # }