Learn R Programming

weatherOz (version 2.0.1)

get_dpird_apsim: Get DPIRD Summary Weather Data in the APSIM Format From the Weather 2.0 API

Description

Automates the retrieval and conversion of summary data from the DPIRD Weather 2.0 API to an APSIM .met file formatted weather data object.

Usage

get_dpird_apsim(
  station_code,
  start_date,
  end_date = Sys.Date(),
  api_key = get_key(service = "DPIRD")
)

Value

An apsimx object of class ‘met’ with attributes.

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.

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.

Saving objects

To save “met” objects the apsimx::write_apsim_met() is reexported. Note that when saving, comments from SILO will be included, but these will not be printed as a part of the resulting met object in your R session.

Author

Adam H. Sparks, adamhsparks@gmail.com

See Also

Other DPIRD: dpird_extreme_weather_values, dpird_minute_values, dpird_summary_values, find_nearby_stations(), find_stations_in(), get_dpird_availability(), get_dpird_extremes(), get_dpird_minute(), get_dpird_summaries(), get_stations_metadata()

Other data fetching: get_ag_bulletin(), get_coastal_forecast(), get_data_drill(), get_data_drill_apsim(), get_dpird_extremes(), get_dpird_minute(), get_dpird_summaries(), get_patched_point(), get_patched_point_apsim(), get_precis_forecast(), get_radar_imagery(), get_satellite_imagery()

Other APSIM: get_data_drill_apsim(), get_patched_point_apsim(), reexports

Examples

Run this code
if (FALSE) {
# Get an APSIM format object for Binnu
# Note that you need to supply your own API key

wd <- get_dpird_apsim(
  station_code = "BI",
  start_date = "20220101",
  end_date = "20221231",
  api_key = "your_api_key"
)
}


Run the code above in your browser using DataLab