Skip to contents

Return a data frame containing SILO Australian weather data for the specified weather station, date range (from start_date to finish_date, inclusive) and the specified variables. By default, all available weather variables are returned if none are specified. If no finish date is provided, the date range is taken from the given start date up to today's date (i.e. so up to the most recently uploaded weather information on the SILO server, which is updated daily).

Usage

get_station_data(
  station,
  start_date,
  finish_date = Sys.Date(),
  variables = weather_variables()$variable_name,
  pretty_names = TRUE
)

Arguments

station

A numeric station ID, or else a character station name.

start_date

A string or Date object for the starting date

finish_date

A string or Date object for the finish date (Default: today's date, so retrieves up to most recently updated weather data available)

variables

A vector containing the variable names (Default: retrieve all available weather variables)

pretty_names

Whether to format the columns with prettied variable names (Default: TRUE). Set this to FALSE to format the column names as syntactically valid variable names (at the cost of some readability)

Value

A data.frame containing the downloaded weather data

Examples

weather_data <- get_station_data(
  23031, '2020-01-01', '2020-03-31', c('rainfall', 'max_temp')
)
head(weather_data)
#>         Date Elevation (m) Rainfall (mm) Maximum Temperature (degC)
#> 1 2020-01-01         115.0           0.0                       25.8
#> 2 2020-01-02         115.0           0.0                       32.9
#> 3 2020-01-03         115.0           0.0                       40.4
#> 4 2020-01-04         115.0           0.0                       23.4
#> 5 2020-01-05         115.0           3.2                       17.0
#> 6 2020-01-06         115.0           0.7                       26.4