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

View source: R/GetData.R

GetDataSEPA_RainR Documentation

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

Description

Extract hourly rainfall data from SEPA's API.

Usage

GetDataSEPA_Rain(
  Lat = NULL,
  Lon = NULL,
  Range = 30,
  StationName,
  From = NULL,
  To = NULL
)

Arguments

Lat

Latitude of the point of interest. Provided when the user wants information about available local rain gauges

Lon

Longitude of the point of interest. Provided when the user wants information about available local rain gauges

Range

The radius (km) from the point of interest (Lat, Lon) for which the user wants a list of rain gauges (default is 30).

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". Default of NULL means the earliest available date is used

To

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

Details

You can download data using the gauge name and you can find gauges within a given range using the latitude and longitude. If the 'From' date is left as null, the earliest date of available data will be used. If the 'To' date is left as null, the most recent date of available data will be used.

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:  GetDataSEPA_Rain(StationName = "AnythingButAStationName") 
#Now we'll get rain from the Bannockburn station
## Not run:  Bannockburn <- GetDataSEPA_Rain(StationName = "Bannockburn",
From = "1998-10-01", To = "1998-10-31") 
## End(Not run)
#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 April 4, 2025, 12:55 a.m.

Related to GetDataSEPA_Rain in UKFE...