A helper function that wraps two functions from weatherOz to fetch daily weather data from both the DPIRD Weather 2.0 and SILO Patched Point APIs and return a list of these objects. Values are predetermined and only those that are shared between the two APIs are returned.

get_weather_list(stations, first, last = Sys.Date(), api_keys)

Arguments

first

The date on which the weather data should start, provided in ISO8601 format, e.g. "2021-01-01".

last

The last date on which the weather data should end, provided in ISO8601 format, e.g. "2021-01-01". Defaults to the current system date.

api_keys

A vector of API keys for the DPIRD Weather 2.0 API and the SILO API in that order (it's alphabetical, DPIRD, SILO).

station_code

A vector of values that provides station codes, station_code from weatherOz.

Value

A list of data.frame objects containing weather data from DPIRD and SILO

APIs as requested.

Examples


# Note that you must provide your own API keys to use this function

get_weather_list(
  stations = c("4041", "BA"),
  first = "2021-01-01",
  last = "2021-01-02",
  api_keys = c(Sys.getenv("DPIRD_API_KEY"),
               Sys.getenv("SILO_API_KEY"))
)
#> You have requested station observation data but some rows in this
#> dataset have data codes for interpolated data.
#> Check the 'data_source' columns and `get_patched_point()` or
#> `get_data_drill()` documentation for further details on codes and
#> references.
#> $Warrawagine
#>    station_code station_name longitude latitude year month day       date
#> 1:       004041  Warrawagine  120.6961 -20.8508 2021     1   1 2021-01-01
#> 2:       004041  Warrawagine  120.6961 -20.8508 2021     1   2 2021-01-02
#>    air_tmax air_tmin rainfall rh_tmax rh_tmin
#> 1:     40.6     28.2       26    34.1    68.0
#> 2:     40.6     28.0        0    30.9    62.2
#> 
#> $Badgingarra
#>    station_code station_name longitude  latitude year month day       date
#> 1:           BA  Badgingarra  115.5395 -30.33805 2021     1   1 2021-01-01
#> 2:           BA  Badgingarra  115.5395 -30.33805 2021     1   2 2021-01-02
#>    air_tmax air_tmin rainfall rh_tmax rh_tmin
#> 1:     36.1     15.7      0.0   100.0    18.4
#> 2:     34.6     18.4      0.2    68.4    23.1
#>