Package 'RivRetrieve'

Title: Retrieve Global River Gauge Data
Description: Provides access to global river gauge data from a variety of national-level river agencies. The package interfaces with the national-level agency websites to provide access to river gauge locations, river discharge, and river stage. Currently, the package is available for the following countries: Australia, Brazil, Canada, Chile, France, Japan, South Africa, the United Kingdom, and the United States.
Authors: Ryan Riggs [aut, cre] , Simon Moulds [aut] , Michel Wortmann [aut] , Louise Slater [aut] , George Allen [aut]
Maintainer: Ryan Riggs <[email protected]>
License: MIT + file LICENSE
Version: 0.1.5
Built: 2024-10-31 18:38:49 UTC
Source: https://github.com/ryan-riggs/rivretrieve

Help Index


RivRetrieve: Retrieve global river and stage data

Description

Provides access to global river gauge data from a variety of national-level river agencies. The package interfaces with the national-level agency websites to provide access to river gauge locations, river discharge, and river stage. Currently, the package is available for the following countries: Australia, Brazil, Canada, Chile, France, Japan, South Africa, the United Kingdom, and the United States.

Author(s)

Maintainer: Ryan Riggs [email protected] (ORCID)

Authors:

See Also

Useful links:

Examples

## Not run: 
print("TODO")

## End(Not run)

australia

Description

Retrieve Australian gauge data

Usage

australia(
  site,
  variable = "discharge",
  start_date = NULL,
  end_date = NULL,
  sites = FALSE,
  ...
)

Arguments

site

Australian gauge number

variable

Character. Either stage or discharge.

start_date

Character. Optional start date with format YYYY-MM-DD. Default is 1900-01-01.

end_date

Character. End date with format YYYY-MM-DD. Default is the current date.

sites

Logical. If TRUE, returns a list of measurement sites.

...

Additional arguments. None implemented.

Value

data frame of discharge time-series

Examples

## Not run: 
sites <- australia(sites = TRUE)
df <- australia(sites$site[1], "stage")
plot(df$Date, df$H, type='l')

## End(Not run)

brazil

Description

Retrieve Brazilian gauge data

Usage

brazil(
  site,
  variable = "discharge",
  start_date = NULL,
  end_date = NULL,
  sites = FALSE,
  ...
)

Arguments

site

Brazilian gauge number

variable

Character. Either stage or discharge.

start_date

Character. Optional start date with format YYYY-MM-DD. Default is 1900-01-01.

end_date

Character. End date with format YYYY-MM-DD. Default is the current date.

sites

Logical. If TRUE, returns a list of measurement sites.

...

Additional arguments. None implemented.

Value

data frame of discharge time-series

Examples

## Not run: 
df <- brazil('12650000')
plot(df$Date, df$Q, type='l')

## End(Not run)

canada

Description

Retrieve Canadian gauge data

Usage

canada(
  site,
  variable = "discharge",
  start_date = NULL,
  end_date = NULL,
  sites = FALSE,
  ...
)

Arguments

site

Canadian gauge number

variable

Character. Either stage or discharge.

start_date

Character. Optional start date with format YYYY-MM-DD. Default is 1900-01-01.

end_date

Character. End date with format YYYY-MM-DD. Default is the current date.

sites

Logical. If TRUE, returns a list of measurement sites.

...

Additional arguments. None implemented.

Value

data frame of discharge time-series

Examples

## Not run: 
#For the first time, you must run:
tidyhydat::download_hydat()
df = canada("01AD003")
plot(df$Date, df$Q, type='l')

## End(Not run)

chile

Description

Retrieve Chilean gauge data

Usage

chile(
  site,
  variable = "discharge",
  start_date = NULL,
  end_date = NULL,
  sites = FALSE,
  ...
)

Arguments

site

Chilean gauge number

variable

Character. Either stage or discharge.

start_date

Character. Optional start date with format YYYY-MM-DD. Default is 1900-01-01.

end_date

Character. End date with format YYYY-MM-DD. Default is the current date.

sites

Logical. If TRUE, returns a list of measurement sites.

...

Additional arguments. None implemented.

Value

data frame of discharge time-series

Examples

## Not run: 
df <- chile('01201005')
plot(df$Date, df$Q, type='l')

## End(Not run)

france

Description

Retrieve French gauge data

Usage

france(
  site,
  variable = "discharge",
  start_date = NULL,
  end_date = NULL,
  sites = FALSE,
  ...
)

Arguments

site

French gauge number

variable

Character. Either stage or discharge.

start_date

Character. Optional start date with format YYYY-MM-DD. Default is 1900-01-01.

end_date

Character. End date with format YYYY-MM-DD. Default is the current date.

sites

Logical. If TRUE, returns a list of measurement sites.

...

Additional arguments. None implemented.

Value

data frame of discharge time-series

Examples

## Not run: 
df <- france('K027401001')
plot(df$Date, df$Q, type='l')

## End(Not run)

Retrieve the timeseries ID

Description

get_timeseries_id retrieves the timeseries ID that can be used to obtain values for a parameter type, station and timeseries combination.

Usage

get_timeseries_id(parameter_type, station_number, ts_name)

Arguments

parameter_type

The parameter of interest (e.g. Water Course Discharge).

station_number

The AWRC station number.

ts_name

The BoM time series name (e.g. DMQaQc.Merged.DailyMean.24HR).

Value

Returns a tibble with columns station_name, station_no, station_id, ts_id, ts_name, parametertype_id, parametertype_name.


japan

Description

Retrieve Japanese gauge data

Usage

japan(
  site,
  variable = "discharge",
  start_date = NULL,
  end_date = NULL,
  sites = FALSE,
  ...
)

Arguments

site

Japanese gauge number

variable

Character. Either stage or discharge.

start_date

Character. Optional start date with format YYYY-MM-DD. Default is 1900-01-01.

end_date

Character. End date with format YYYY-MM-DD. Default is the current date.

sites

Logical. If TRUE, returns a list of measurement sites.

...

Additional arguments. None implemented.

Value

data frame of discharge time-series

Examples

## Not run: 
start_date <- as.Date("2019-01-01")
end_date <- as.Date("2022-12-31")
df <- japan("301011281104010", "discharge", start_date, end_date)
plot(df$Date, df$Q, type='l')

## End(Not run)

Query the BoM WISKI API

Description

This function queries the Bureau of Meteorology Water Data KISTERS API. A parameter list is passed to make request and the JSON return is parsed depending on what is requested. This function can be used if you want to build your own JSON queries.

Usage

make_bom_request(params)

Arguments

params

A named list of parameters.

Value

A tibble is returned with the columns depending on the request. For get_timeseries requests, a tibble with zero rows is returned if there is no data available for that query.


Get original data

Description

Get original data

Usage

original(x, ...)

Arguments

x

Tibble.

...

Additional arguments. None implemented.

Value

list


Plot values

Description

Plot values

Usage

## S3 method for class 'rr_tbl'
plot(x, ...)

Arguments

x

Tibble.

...

Additional arguments. None implemented.

Value

ggplot2


southAfrica

Description

Retrieve South African gauge data

Usage

southAfrica(
  site,
  variable = "stage",
  start_date = NULL,
  end_date = NULL,
  sites = FALSE,
  ...
)

Arguments

site

South African gauge number

variable

Character. Either stage or discharge.

start_date

Character. Optional start date with format YYYY-MM-DD. Default is 1900-01-01.

end_date

Character. End date with format YYYY-MM-DD. Default is the current date.

sites

Logical. If TRUE, returns a list of measurement sites.

...

Additional arguments. None implemented.

Value

data frame of discharge time-series

Examples

## Not run: 
site <- "X3H023"
start_date <- as.Date("2000-01-01")
end_date <- as.Date("2010-01-01")
x <- southAfrica(site, "stage", start_date, end_date)

## End(Not run)

uk

Description

Retrieve UK gauge data

Usage

uk(site, variable, start_date = NULL, end_date = NULL, sites = FALSE, ...)

Arguments

site

UK gauge number

variable

Character. Either stage or discharge.

start_date

Character. Optional start date with format YYYY-MM-DD. Default is 1900-01-01.

end_date

Character. End date with format YYYY-MM-DD. Default is the current date.

sites

Logical. If TRUE, returns a list of measurement sites.

...

Additional arguments. None implemented.

Value

data frame of discharge time-series

Examples

site <- "http://environment.data.gov.uk/hydrology/id/stations/3c5cba29-2321-4289-a1fd-c355e135f4cb"
x <- uk(site, variable = "discharge")
plot(x$Date, x$Q, type='l')

usa

Description

Retrieve USA gauge data

Usage

usa(
  site,
  variable = "stage",
  start_date = NULL,
  end_date = NULL,
  sites = FALSE,
  ...
)

Arguments

site

USA gauge number

variable

Character. Either stage or discharge.

start_date

Character. Optional start date with format YYYY-MM-DD. Default is 1900-01-01.

end_date

Character. End date with format YYYY-MM-DD. Default is the current date.

sites

Logical. If TRUE, returns a list of measurement sites.

...

Additional arguments. None implemented.

Value

data frame of discharge time-series

Examples

## Not run: 
df <- usa("02471078", variable="discharge")
plot(df$Date, df$Q, type='l')

## End(Not run)