knitr::opts_chunk$set( collapse = TRUE, comment = "#>" ) library(httptest) start_vignette("bomWater")
bomWater
provides an interface to the Australian Bureau of Meteorology Water Data online (http://www.bom.gov.au/waterdata/) web service. As part of the Water Act 2007, the BoM is required to collect Australian water information and make it available to the public. This provides a single and convenient source of water data for all states and territories. Several hydrological and meteorological quality checked timeseries are available through Water Data online and bomWater
provides several functions to access these timeseries.
A typical workflow begins by querying station information using get_station_list()
with a specific parameter type. The function parameters()
returns all the parameters that can be retrieved using bomWater
. By default get_station_list()
returns all stations for Water Course Discharge and other parameters can be specified with the argument parameter_type
. Once the station number of interest is known, it can be used to retrieve quality-checked timeseries using the functions:
get_hourly()
: retrieves hourly dataget_daily()
: retrieves daily dataget_monthly()
: retrieves monthly dataget_yearly()
: retrieves annual dataget_as_stored()
: retrieves data as stored by BoMTimeseries that are based on aggregated data return the mean by default, however other variables such as min and max are often available. The functions will return a tibble
with three columns: Timestamp, Value and Quality Code.
The following Water Data Online variables can be accessed using these functions:
| Parameter | Units | | ------------------------------ | ------ | | Water Course Discharge | m3/s | | Water Course Level | m | | Electrical conductivity at 25C | µS/cm | | Turbidity | NTU | | pH | pH | | Water Temperature | ºC | | Storage Volume | ML | | Storage Level | m | | Ground Water Level | m | | Rainfall | mm | | Evaporation | mm | | Dry Air Temperature | ºC | | Relative Humidity | % | | Wind Speed | m/s |
The following table is from the (BoM SOS2 manual) (6.3.3, pg 41) and summarises the quality codes.
| SOS2 Qualifier | Quality code | Description | | -------------- | ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | 10 | A | The record set is the best available given the technologies, techniques and monitoring objectives at the time of classification. | | 90 | B | The record set is compromised in its ability to truly represent the parameter. | | 110 | C | The record set is an estimate. | | 140 | E | The record set's ability to truly represent the monitored parameter is not known. | | 210 | F | The record set is not of release quality or contains missing data. |
Load bomWater
as well as ggplot
to make some plots.
library(bomWater) library(ggplot2)
The parameter names can be retrieved from bomWater
using parameters()
. parameters()
takes no argument. Make sure the formatting of the parameter types is as returned by this function otherwise an error may be raised.
Returns a vector of parameter types.
parameters()
'get_station_list' queries Water Data Online and returns station details. Queries can be input with the desired 'parameter_type' to find all the stations on record. If you already have a vector of station numbers, you can pass the vector to 'station_number' and return the details of those stations. 'return_fields' can be customised to return various data about the stations.
With the default return fields, a tibble with columns station_name, station_no, station_id, station_latitude, station_longitude.
# Get a list of groundwater bores available from water data online get_station_list(parameter_type = "Ground Water Level") # Return information for a single station and customise return fields get_station_list(station_number = "410730")
get_hourly
returns hourly data. Only Water Course Discharge, Water Course Level, Storage Level and Storage Volume can be requested using get_hourly
.
Returns a tibble with Timestamp, Value and Quality Code.
# Cotter River at Gingera get_hourly( parameter_type = "Water Course Discharge", station_number = "410730", start_date = "2020-01-01", end_date = "2020-01-31" ) # Corin Reservoir get_hourly( parameter_type = "Storage Volume", station_number = "410742", start_date = "2020-01-01", end_date = "2020-01-31" )
An example of plotting the data:
corin <- get_hourly( parameter_type = "Storage Volume", station_number = "410742", start_date = "2020-01-01", end_date = "2020-01-31" ) ggplot(corin, aes(Timestamp, Value)) + geom_line() + labs(x = "Time", y = "Storage Volume (ML)")
Retrieves timeseries at a daily timestep. For continuous data, the daily mean (default), max, and min can be returned by specifying the var
argument. Daily totals are returned for discrete parameters (e.g. rainfall and evaporation). Timeseries aggregated between 9am to 9am for Rainfall and Water Course Discharge can be retrieved using the aggregation
argument to match the standard BoM rainfall reporting.
A tibble with columns Timestamp, Value and Quality Code.
# Daily mean streamflow from Cotter River at Gingera (in m3/s) between 09-09 get_daily( parameter_type = "Water Course Discharge", station_number = "410730", start_date = "2020-01-01", end_date = "2020-01-31", aggregation = "09HR" ) # Daily max, only available over the standard day get_daily( parameter_type = "Water Course Discharge", station_number = "410730", start_date = "2020-01-01", end_date = "2020-01-31", var = "max" ) # Daily mean wind speed at Corin Dam get_daily( parameter_type = "Wind Speed", station_number = "570947", start_date = "2020-01-01", end_date = "2020-01-31" )
Retrieves timeseries at a monthly timestep. Monthly totals are returned for discrete parameters (e.g. rainfall and evaporation), while the mean rate is returned for continuous parameters.
A tibble with columns Timestamp, Value and Quality Code.
# Monthly total rainfall in mm at Cotter Hut get_monthly( parameter_type = "Rainfall", station_number = "570946", start_date = "2019-01-01", end_date = "2019-12-31" ) # Monthly mean streamflow rate m3/s at Cotter River at Gingera get_monthly( parameter_type = "Water Course Discharge", station_number = "410730", start_date = "2019-01-01", end_date = "2019-12-31" ) # Monthly evaporation at Blowering Dam get_monthly( parameter_type = "Evaporation", station_number = "410102", start_date = "2019-01-01", end_date = "2019-12-31" ) # No data
Retrieves timeseries at an annual timestep. Annual totals are returned for discrete parameters (e.g. rainfall and evaporation), while the mean rate is returned for continuous parameters.
A tibble with columns Timestamp, Value and Quality Code.
# Annual rainfall at Berthong in Cootamundra berthong <- get_yearly( parameter_type = "Rainfall", station_number = "41000207", start_date = "2010-01-01", end_date = "2019-12-31" ) # Example plot ggplot(berthong, aes(Timestamp, Value)) + geom_col() + labs(x = "Time", y = "Rainfall (mm/year)")
Retrieves timeseries as stored by the BoM. Stored frequency could vary substantially between different parameters and locations.
A tibble with columns Timestamp, Value and Quality Code.
# Annual rainfall at Berthong in Cootamundra berthong <- get_as_stored( parameter_type = "Rainfall", station_number = "41000207", start_date = "2019-01-01", end_date = "2019-12-31" ) berthong
The license and copyright for the data can be viewed under the copyright tab at http://www.bom.gov.au/waterdata/. More information about the Bureau of Meteorology copyright can be found at http://www.bom.gov.au/other/copyright.shtml.
end_vignette()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.