GetDataSEPA_QH: Get flow or level data from the Scottish Environmental...

View source: R/GetData.R

GetDataSEPA_QHR Documentation

Get flow or level data from the Scottish Environmental Protection Agency.

Description

Function to extract flow or level data from SEPA.

Usage

GetDataSEPA_QH(
  Lat = NULL,
  Lon = NULL,
  RiverName = NULL,
  Type = "Flow",
  StationID = NULL,
  Range = 20,
  From = NULL,
  To = NULL,
  Period = "Daily"
)

Arguments

Lat

Latitude (as a decimal) for the centre of the search for gauges. You can convert BNG to Lat and Lon using the GridRefConvert function.

Lon

Longitude (as a decimal) for the centre of the search for gauges. You can convert BNG to Lat and Lon using the GridRefConvert function.

RiverName

Name of the river along which you want to search for gauges. Character string.

Type

The variable to extract, either "flow" or "level"

StationID

The ID for the gauge from which you want to obtain data (character string)

Range

Radius of search when using latitude and longitude inputs (km).

From

Date for start of data extraction in the format of "2015-12-02". If NULL the first date of the available data is used.

To

Date for the end of data extraction in the format of "2015-12-02". If NULL the present date is used (and most recent available data is returned).

Period

The sampling rate of the data you want. Either "Daily", "Hourly", or "15Mins".

Details

To find gauges you can input either a river name or a latitude and longitude. You can convert BNG to Lat and Lon using the ConvertGridRef function. The lat and lon option will provide all flow or level gauges within a specified range (default of 50km). This provides gauged details including the StationID. You can get data from specific gauges using the StationID. Note that flow gauges also have level data available. You can get data from a date range using the From and To arguments. If the From and To arguments are left as NULL the full range of available data are returned.

Value

If searching for gauge details with lat and lon or river name, then a dataframe is returned with necessary information to obtain flow or level data. When extracting flow or level data with a station ID then a dataframe with two columns is returned. The first being a Date or POSIXct column/vector and the second is the timeseries of interest.

Author(s)

Anthony Hammond

Examples

#Find gauges on the river Spey
## Not run: GetDataSEPA_QH(RiverName = "Spey")
#Find gauges within 20km of a latlon grid reference somewhere near the centre of Scotland
## Not run: GetDataSEPA_QH(lat = 56, lon = -4, Range = 20)
#Get all available daily mean flow data from the Boat o Brig gauge on the Spey
## Not run: SpeyDaily <- GetDataSEPA_QH(StationID = "37174")
#Get 15-minute data from the Boat o Brig for the highest recorded peak
## Not run: BoatOBrigAug1970 <- GetDataSEPA_QH(StationID = "37174",
From = "1970-08-16", To = "1970-08-19", Period = "15Mins")
## End(Not run)

UKFE documentation built on April 4, 2025, 12:55 a.m.

Related to GetDataSEPA_QH in UKFE...