GetRainSEPA: Get Scottish Environment Protection Agency (SEPA) hourly...

View source: R/RainAPI.R

GetRainSEPAR Documentation

Get Scottish Environment Protection Agency (SEPA) hourly rainfall data.

Description

Extract hourly rainfall data from SEPA's API.

Usage

GetRainSEPA(StationName, From = "2022-10-01", To = "ToDate")

Arguments

StationName

The name of the station for which you want rainfall. If you type something other than one of the available stations, the list of stations will be returned.

From

A start date for the data in the form of "YYYY-MM-DD".

To

An end date for the data in the form of "YYYY-MM-DD". The default is the most recent date available.

Details

If the "From" date used is significantly before (approx. 30 years) the start of the available data, the function will fail with an error message saying the connection cannot be opened.

Value

A data.frame with POSIXct in the first column, and rainfall in the second column. Unless the StationName provided is not in the available list, then the available list is returned.

Author(s)

Anthony Hammond

Examples

#Get the list of available stations
## Not run:  GetRainSEPA("AnythingButAStationName") 
#Now we'll get rain from the Bannockburn station
## Not run:  Bannockburn <- GetRainSEPA("Bannockburn", From = "1998-10-01", To = "1998-10-31") 
#Now we'll have a look at the top of the data and plot it
## Not run:  head(Bannockburn) 
## Not run:  plot(Bannockburn, type = "h", ylab = "Rainfall (mm)") 

UKFE documentation built on Sept. 30, 2024, 9:46 a.m.

Related to GetRainSEPA in UKFE...