R/get_winfapapi.R
get_pot.Rd
The function queries the NRFA API for the .PT file similar to the WINFAP file for a given stations. It then processes the file in a fashion similar to read_pot
.
get_pot(station, getAmax = FALSE)
the NRFA station number for which peaks over threshold information should be obtained. It can also be a vector of station numbers
logical. If TRUE
information on the annual maxima values will be retrieved and attached to the WaterYearInfo
table
Like read_pot
a list of three objects tablePOT
, WaterYearInfo
and dateRange
.
tablePOT
contains a table with all the peaks above the threshold present in the record
WaterYearInfo
a table containing the information on the percentage of missing values
in any water year for which some data is available in the POT record. This is useful to assess
whether the lack of exceedances is genuine or the result of missing data and to assess whether the threshold
exceedances present in tablePOT
can be deemed to be representative of the whole year
dateRange
a vector with the first and last date of recording for the POT record as provided in the [POT Details] field.
Note that this period might be different than the period for which annual maxima records are available
read_pot
. Information on the peaks over threshold records and river flow gauging in the UK can be found at the National River Flow Archive website https://nrfa.ceh.ac.uk
# \donttest{
### the example take longer than 5 seconds to run
p40003 <- get_pot(40003) # the Medway at Teston / East Farleigh
p40003$tablePOT[p40003$tablePOT$WaterYear > 1969 &
p40003$tablePOT$WaterYear < 1977,]
#> Station Date WaterYear Flow Stage
#> 30 40003 1971-01-24 1970 125.000 0.00
#> 31 40003 1973-01-29 1972 150.153 7.04
#> 32 40003 1974-02-12 1973 234.527 8.36
#> 33 40003 1974-02-15 1973 148.985 7.02
#> 34 40003 1974-11-14 1974 147.821 7.00
#> 35 40003 1974-11-23 1974 229.496 8.30
#> 36 40003 1975-01-21 1974 177.825 7.50
#> 37 40003 1975-01-27 1974 143.768 6.93
#> 38 40003 1975-05-17 1974 150.738 7.05
#> 39 40003 1976-12-01 1976 151.323 7.06
#> 40 40003 1977-01-15 1976 160.199 7.21
### no events in 1971 nor 1975
p40003$WaterYearInfo[p40003$WaterYearInfo$WaterYear > 1969 &
p40003$WaterYearInfo$WaterYear < 1977,]
#> WaterYear potPercComplete potThreshold
#> 15 1970 100.000000 122.571
#> 16 1971 100.000000 122.571
#> 17 1972 100.000000 122.571
#> 18 1973 37.534247 122.571
#> 19 1974 29.041096 122.571
#> 20 1975 2.185792 122.571
#> 21 1976 26.575342 122.571
# in 1971 all records are valid,
# in 1975 no exceedances
# might be due to the fact that almost no valid record are available
p40003 <- get_pot(40003, getAmax = TRUE)
p40003$WaterYearInfo[p40003$WaterYearInfo$WaterYear > 1969 &
p40003$WaterYearInfo$WaterYear < 1977,]
#> Station WaterYear amaxDate amaxFlow amaxStage amaxRejected potPercComplete
#> 15 40003 1970 1971-01-24 125.000 0.00 FALSE 100.000000
#> 16 40003 1971 1972-01-11 71.120 2.80 FALSE 100.000000
#> 17 40003 1972 1973-01-29 150.153 7.04 FALSE 100.000000
#> 18 40003 1973 1974-02-12 234.527 8.36 FALSE 37.534247
#> 19 40003 1974 1974-11-23 229.496 8.30 FALSE 29.041096
#> 20 40003 1975 1975-12-02 114.864 6.41 FALSE 2.185792
#> 21 40003 1976 1977-01-15 160.199 7.21 FALSE 26.575342
#> potThreshold
#> 15 122.571
#> 16 122.571
#> 17 122.571
#> 18 122.571
#> 19 122.571
#> 20 122.571
#> 21 122.571
# the annual maximum in 1971 and 1975 was below the threshold
# no events exceeded the threshold
# }