GetRainEA {UKFE} | R Documentation |
Get Environment Agency rainfall data (England).
Description
Extract rainfall data from the Environment Agency's API.
Usage
GetRainEA(
Lat = 54,
Lon = -2,
Range = 10,
WISKI_ID = NULL,
Period = 0.25,
DateSt = "2015-12-01",
DateEnd = "2015-12-31"
)
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 rain gauge information. |
WISKI_ID |
The WISKI identification (as "character") for the rain gauge of interest |
Period |
The sampling rate of the rainfall in hours (generally 0.25 or 24. Default is 0.25 (15 minutes). |
DateSt |
The start date of the data extraction in the form of "YYYY-MM-DD". |
DateEnd |
The end date of the data extraction in the form of "YYYY-MM-DD". |
Details
The function provides one of two outputs. Either information about available local rain gauges, or the data from a specified gauge (specified by WISKI ID). The process is to find the local information (including WISKI ID) by using the latitude and longitude and range. Then use the WISKI ID to get the data. If data requested is not available, for example - outside the date range or not available at the requested sampling rate, an error message is returned stating "no lines available in input". There is currently a 2 million line limit for each use. that is over 5000 years of daily data or 57 years of 15 minute data. However, the 15 minute data can take quite a while and if it takes over 60 seconds a timeout message is returned. hen testing the function I could get 20 years at a time but not 30. Presumably it depends on the connection?
Value
A data.frame with POSIXct (DateTime) in the first column, and rainfall (mm) in the second column. Unless the WISKI_ID is null, then information about rain gauges approximately within a radius (Range) of the Lat and Lon is povided.
Author(s)
Anthony Hammond
Examples
#Get information about available rain gauges.
#within a 10km radius of Lat = 54.5, Lon = -3.2
## Not run: RainEA(Lat = 54.5, Lon = -3.2)
#Now we'll use the WISKI reference for the Honister rain gauge
# to get some data for the Dec 2015 (default dates)
## Not run: Honister15 <- RainEA(WISKI_ID = "592463")
#Now we'll have a look at the top of the data and plot it
## Not run: head(Honister15)
## Not run: plot(Honister15, type = "h", ylab = "Rainfall (mm)")
#Now we'll get the daily rain for the same period and plot it
## Not run: Honister24 <- RainEA(WISKI_ID = "592463", Period = 24)
## Not run: plot(Honister24, type = "h", ylab = "Rainfall (mm)")