get_dpird_summaries {weatherOz}R Documentation

Get DPIRD Weather Data in Summarised Formats

Description

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

Usage

get_dpird_summaries(
  station_code,
  start_date,
  end_date = Sys.Date(),
  interval = c("daily", "15min", "30min", "hourly", "monthly", "yearly"),
  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.

start_date

A character string or Date 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 or Date 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 to monthly or yearly. 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 to all with all available values being returned.

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 in alphabetical order. The first ten columns will always be:

Start Dates

The earliest available data start from August of 2000 for Vasse, “VA”.

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

Note

Please note this function converts date-time columns from Coordinated Universal Time ‘UTC’ to Australian Western Standard Time ‘AWST’.

Author(s)

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

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_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()

Examples

## Not run: 
# 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"
    )
)

## End(Not run)

[Package weatherOz version 1.0.0 Index]