GetDataEA_QH: Get flow or level data from the Environment Agency's...

View source: R/GetData.R

GetDataEA_QHR Documentation

Get flow or level data from the Environment Agency's Hydrology Data Explorer

Description

Function to extract flow or level data from the Environment Agency's Hydrology Data Explorer.

Usage

GetDataEA_QH(
  Lat = 54,
  Lon = -2.25,
  Range = 20,
  RiverName = NULL,
  WISKI_ID = NULL,
  From = NULL,
  To = NULL,
  Type = "flow",
  Period = "DailyMean"
)

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.

Range

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

RiverName

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

WISKI_ID

The WISKI ID for the gauge from which you want to obtain data (character string). Note that sometimes a preceding zero, which is not returned via the API, is needed. If the data extraction fails, this may be the cause and you can resolve it by including the preceding zero in the WISKI_ID.

From

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

To

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

Type

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

Period

The sampling rate of the data you want. Either "DailyMax", "DailyMean", "Hourly", "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 (you can also get lat and lon by left clicking on google maps). The lat and lon option will provide all flow and level gauges within a specified range (default of 10km). This provides gauged details including the WISKI ID. You can get data from specific gauges using the WISKI_ID. Note that flow gauges also have level data available. You can get data from a date range using the From and To arguments or you can return all data by leaving the From and To as the default (NULL). Lastly, WISKI IDs are sometimes returned without a preceding 0 which might be necessary for the data extraction (oddly, most do have the necessary 0). If data extraction fails try adding a 0 to the beginning of the WISKI ID.

Value

If searching for gauge details with lat and lon or river name, then a list is returned. The first element is a dataframe with flow gauge details and the second is a dataframe of level gauge details. When extracting flow or level data with a WISKI 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 Tame
## Not run: GetDataEA_QH(RiverName = "Tame")
#Find gauges within 10km of a latlon grid reference somewhere near the
#centre of Dartmoor
## Not run: GetDataEA_QH(Lat = 50.6, Lon = -3.9, Range = 10)
#Get all available daily maximum flow data from the Bellever gauge on the
#East Dart River.
## Not run: BelleverMax <- GetDataEA_QH(WISKI_ID = "SX67F051")
#Get 15-minute data from the Bellever for the Novermeber 2024 event
## Not run: BelleverNov2024 <- GetDataEA_QH(WISKI_ID = "SX67F051",
From = "2024-11-23", To = "2024-11-25", Period = "15Mins")
## End(Not run)

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

Related to GetDataEA_QH in UKFE...