Package rnrfa. April 13, 2018

Similar documents
Package cattonum. R topics documented: May 2, Type Package Version Title Encode Categorical Features

Package datasets.load

Package geojsonsf. R topics documented: January 11, Type Package Title GeoJSON to Simple Feature Converter Version 1.3.

Package darksky. September 20, 2017

Package fastdummies. January 8, 2018

Package nlgeocoder. October 8, 2018

Package ecoseries. R topics documented: September 27, 2017

Package fitbitscraper

Package opencage. January 16, 2018

Package smapr. October 20, 2017

Package statsdk. September 30, 2017

Package censusapi. August 19, 2018

Package rollply. R topics documented: August 29, Title Moving-Window Add-on for 'plyr' Version 0.5.0

Package validara. October 19, 2017

Package jpmesh. December 4, 2017

Package tidytransit. March 4, 2019

Package ggimage. R topics documented: December 5, Title Use Image in 'ggplot2' Version 0.1.0

Package xtractomatic

Package projector. February 27, 2018

Package repec. August 31, 2018

Package ggimage. R topics documented: November 1, Title Use Image in 'ggplot2' Version 0.0.7

Package rosm. April 8, 2017

Package messaging. May 27, 2018

Package robotstxt. November 12, 2017

Package calpassapi. August 25, 2018

Package gtrendsr. October 19, 2017

Package censusr. R topics documented: June 14, Type Package Title Collect Data from the Census API Version 0.0.

Package canvasxpress

Package gfcanalysis. August 29, 2016

Package xtractomatic

Package waver. January 29, 2018

Package mapsapi. March 12, 2018

Package geniusr. December 6, 2017

Package dkanr. July 12, 2018

Package clipr. June 23, 2018

Package mapr. April 11, 2017

Package facerec. May 14, 2018

Package TrajDataMining

Package gtrendsr. August 4, 2018

Package SEMrushR. November 3, 2018

Package gggenes. R topics documented: November 7, Title Draw Gene Arrow Maps in 'ggplot2' Version 0.3.2

Package rsppfp. November 20, 2018

Package BANEScarparkinglite

Package tiler. June 9, 2018

Package mdftracks. February 6, 2017

Package qualmap. R topics documented: September 12, Type Package

Package kirby21.base

Package ECctmc. May 1, 2018

Package nngeo. September 29, 2018

Package bisect. April 16, 2018

Package spark. July 21, 2017

Package geogrid. August 19, 2018

Package spelling. December 18, 2017

Package omu. August 2, 2018

Package rzeit2. January 7, 2019

Package lumberjack. R topics documented: July 20, 2018

Package pwrab. R topics documented: June 6, Type Package Title Power Analysis for AB Testing Version 0.1.0

Package data.world. April 5, 2018

Package githubinstall

Package aws.transcribe

Package ggseas. June 12, 2018

Package paleobiodb. September 2, 2016

Package barcoder. October 26, 2018

Package osrm. November 13, 2017

Package mapr. March 21, 2018

Package rdryad. June 18, 2018

Package fingertipsr. May 25, Type Package Version Title Fingertips Data for Public Health

Package liftr. R topics documented: May 14, Type Package

Package imdbapi. April 24, 2018

Package bigreadr. R topics documented: August 13, Version Date Title Read Large Text Files

Package docxtools. July 6, 2018

Package frequencyconnectedness

Package loggit. April 9, 2018

Package WordR. September 7, 2017

Package fastqcr. April 11, 2017

Package virustotal. May 1, 2017

Package oec. R topics documented: May 11, Type Package

Package profvis. R topics documented:

Package vinereg. August 10, 2018

Package splithalf. March 17, 2018

Package preprosim. July 26, 2016

Package humanize. R topics documented: April 4, Version Title Create Values for Human Consumption

Package TrafficBDE. March 1, 2018

Package kdtools. April 26, 2018

Package postgistools

Package hypercube. December 15, 2017

Package vip. June 15, 2018

Package bea.r. December 8, 2017

Package guardianapi. February 3, 2019

Package reval. May 26, 2015

Package balance. October 12, 2018

Package tidylpa. March 28, 2018

Package biotic. April 20, 2016

Package osmdata. February 22, 2018

Package raker. October 10, 2017

Package gcite. R topics documented: February 2, Type Package Title Google Citation Parser Version Date Author John Muschelli

Package knitrprogressbar

Package RODBCext. July 31, 2017

Package essurvey. August 23, 2018

Package sigmanet. April 23, 2018

Transcription:

Package rnrfa April 13, 2018 Title UK National River Flow Archive Data from R Version 1.4.0 Maintainer Claudia Vitolo <cvitolodev@gmail.com> URL http://cvitolo.github.io/rnrfa/ BugReports https://github.com/cvitolo/rnrfa/issues Utility functions to retrieve data from the UK National River Flow Archive (<http://nrfa.ceh.ac.uk/>). The package contains R wrappers to the UK NRFA data temporary-api. There are functions to retrieve stations falling in a bounding box, to generate a map and extracting time series and general information. Depends R (>= 3.0.2) Imports rgdal, plyr, graphics, stats, httr, xml2, stringr, xts, rjson, ggmap, ggplot2, sp, parallel Suggests testthat, knitr LazyData true Encoding UTF-8 License GPL-3 Repository CRAN RoxygenNote 6.0.1 NeedsCompilation no Author Claudia Vitolo [aut, cre], Matthew Fry [ctb] (Matthew supervised the unofficial API integration.), Wouter Buytaert [ctb] (This package is part of Claudia Vitolo's PhD work and Wouter is the supervisor.), Michael Spencer [ctb] (Michael updated the function osg_parse to work with grid references of different lengths.), Tobias Gauster [ctb] (Tobias improved the function osg_parse introducing vectorisation) Date/Publication 2018-04-13 14:38:02 UTC 1

2 catalogue R topics documented: rnrfa-package........................................ 2 catalogue.......................................... 2 cmr............................................. 4 convert_flow......................................... 5 gdf.............................................. 5 get_ts............................................ 6 osg_parse.......................................... 7 plot_rain_flow........................................ 8 plot_trend.......................................... 9 seasonal_averages...................................... 10 stationsummary....................................... 10 Index 12 rnrfa-package UK National River Flow Archive data from R rnrfa: UK National River Flow Archive Data from R. Details Utility functions to retrieve data from the UK National River Flow Archive (http://nrfa.ceh.ac.uk/). The package contains R wrappers to the UK NRFA data temporary-api. There are functions to retrieve stations falling in a bounding box, to generate a map and extracting time series and general information. catalogue List of stations from UK NRFA This function pulls the list of stations (and related metadata), falling within a given bounding box, from the CEH National River Flow Archive website. catalogue(bbox = NULL, columnname = NULL, column = NULL, minrec = NULL, all = TRUE)

catalogue 3 bbox columnname column minrec all this is a geographical bounding box (e.g. list(lonmin=-3.82, lonmax=-3.63, lat- Min=52.43, latmax=52.52)) name of column to filter string to search in columnname minimum number of recording years if TRUE it returns all the available metadata. If FALSE, it returns only the following columns: id, name, river, hydrometricarea, operator, haname, catchmentarea, altitude, lat, lon. Details coordinates of bounding box are required in WGS84 (EPSG: 4326). If BB coordinates are missing, the function returns the list corresponding to the maximum extent of the network. Offline you can browse the cached version running the command data(stationsummary) data.frame with list of stations and related metadata Author(s) Claudia Vitolo # Retrieve all the stations in the network x <- catalogue() # Define a bounding box: bbox <- list(lonmin=-3.82, lonmax=-3.63, latmin=52.43, latmax=52.52) # Get stations within the bounding box x <- catalogue(bbox) # Get stations based on minimum number of recording years x <- catalogue(minrec=30)

4 cmr cmr This function retrieves Catchment Mean Rainfall (cmr). Given the station ID number(s), this function retrieves data (time series in zoo format with accompanying metadata) from the WaterML2 service on the NRFA database. Catchment Mean Rainfall is measured in mm/month. cmr(id, metadata = FALSE, cl = NULL, verbose = FALSE) id station ID number(s), each number should be in the range [3002,236051]. metadata cl verbose Logical, FALSE by default. If metadata = TRUE means that the result for a single station is a list with two elements: data (the time series) and meta (metadata). (optional) This is a cluster object, created by the parallel package. This is set to NULL by default, which sends sequential calls to the server. (FALSE by default). If set to TRUE prints GET request on the console. list composed of as many objects as in the list of station ID numbers. Each object can be accessed using their names or index (e.g. x[[1]], x[[2]], and so forth). Each object contains a zoo time series. Author(s) Claudia Vitolo cmr(18019) cmr(c(54022,54090,54091))

convert_flow 5 convert_flow Convert flow from cumecs to mm/d This function converts flow time series from cumecs (m3/s) to mm/d by dividing the flow by the catchment area and converting it to mm/day. convert_flow(flowcumecs, catchmentarea) flowcumecs catchmentarea This is the flow time series in cumecs (m3/s) This is the catchment are in Km2. Flow time series in mm/d convert_flow(30, 2) gdf This function retrieves Gauged Daily Flow (gdf). Given the station ID number(s), this function retrieves data (time series in zoo format with accompanying metadata) from the WaterML2 service on the NRFA database. Gauged Daily Flow is measured in mm/day. gdf(id, metadata = FALSE, cl = NULL, verbose = FALSE)

6 get_ts id station ID number(s), each number should be in the range [3002,236051]. metadata cl verbose Logical, FALSE by default. If metadata = TRUE means that the result for a single station is a list with two elements: data (the time series) and meta (metadata). (optional) This is a cluster object, created by the parallel package. This is set to NULL by default, which sends sequential calls to the server. (FALSE by default). If set to TRUE prints GET request on the console. list composed of as many objects as in the list of station ID numbers. Each object can be accessed using their names or index (e.g. x[[1]], x[[2]], and so forth). Each object contains a zoo time series. Author(s) Claudia Vitolo gdf(18019) gdf(c(54022,54090,54091)) get_ts This function retrieves time series data. Given the station identification number(s), this function retrieves data (time series in zoo format with accompanying metadata) from the WaterML2 service on the NRFA database. The time series can be of two types: cmr (catchment mean rainfall, monthly) or gdf (gauged daily flows, daily). get_ts(id, type, metadata = FALSE, cl = NULL, verbose = FALSE) id station identification number(s), each number should be in the range [3002,236051]. type This is character string that can have one of the two following values: "cmr" (to obtain catchment mean rainfall) or "gdf" (to obtain gauged daily flow).

osg_parse 7 metadata cl verbose Logical, FALSE by default. If metadata = TRUE means that the result for a single station is a list with two elements: data (the time series) and meta (metadata). (optional) This is a cluster object, created by the parallel package. This is set to NULL by default, which sends sequential calls to the server. (FALSE by default). If set to TRUE prints GET request on the console. list composed of as many objects as in the list of station identification numbers. Each object can be accessed using their names or index (e.g. x[[1]], x[[2]], and so forth). Each object contains a zoo time series. Author(s) Claudia Vitolo get_ts(18019, type = "cmr") get_ts(c(54022,54090,54091), type = "cmr") get_ts(18019, type = "gdf") get_ts(c(54022,54090,54091), type = "gdf") osg_parse Converts OS Grid Reference to BNG/WGS coordinates. This function converts an Ordnance Survey (OS) grid reference to easting/northing or latitude/longitude coordinates. osg_parse(gridrefs, CoordSystem = c("bng", "WGS84")) gridrefs CoordSystem This is a string (or a character vector) that contains the OS grid Reference. By default, this is "BNG" which stands for British National Grids. The other option is to set CoordSystem = "WGS84", which returns latitude/longitude coordinates (more info can be found here https://www.epsg-registry.org/).

8 plot_rain_flow vector made of two elements: the easting and northing (by default) or latitude and longitude coordinates. Author(s) Claudia Vitolo # single entry osg_parse(gridrefs="tq722213") # multiple entries osg_parse(gridrefs=c("sn831869","sn829838")) plot_rain_flow Plot rainfall and flow for a given station This function retrieves rainfall and flow time series for a given catchment, divides the flow by the catchment area and converts it to mm/day to that it can be comparable with the rainfall (mm/month). Finally it generates a plots combining rainfall and flow information. plot_rain_flow(id = NULL, rain = NULL, flow = NULL, area = NULL, title = "") id rain flow area title Station identification number Rainfall time series, measured in mm/month Flow time series, measured in m3/s Catchment area in Km2 (optional) Plot title Plot rainfall and flow for a given station

plot_trend 9 plot_rain_flow(id = 54090) plot_trend Plot trend This function plots a previously calculated trend. plot_trend(df, columnname) df columnname Data frame containing at least 4 column: lat (latitude), lon (longitude), Slope and an additional user-defined column columnname. name of the column to use for grouping the results. Two plots, side-by-side, the first showing the distribution of the Trend over a map, based on the slope of the linear model that describes the trend. The second plot shows a boxplot of the Slope grouped based on the column Region. Region and Slope can be user-defined. plot_trend(df, Region)

10 stationsummary seasonal_averages Calculate seasonal averages This calculates the seasonal averages from a time series. seasonal_averages(timeseries, season = "Spring", startseason = NULL, endseason = NULL, parallel = FALSE) timeseries season startseason endseason parallel Time series (xts class). Name of the season (Autumn, Winter, Spring, Summer) String encoding the start of the season (e.g. for spring in the northen hemisphere this is "03-21") String encoding the end of the season (e.g. for spring in the northen emisphere this is "06-20") Logical, FALSE by default. If parallel = TRUE means that the function can be used in parallel computations. A vector containing the seasonal average and significance level (p-value) for each time series. seasonal_averages(cmr(18019), season = "Spring") seasonal_averages(list(cmr(18019), CMR(18019)), season = "Spring") stationsummary stationsummary table containing details for 1537 stations. data(stationsummary)

stationsummary 11 Format A data frame with 1539 observations on the following 20 variables. id a list vector name a list vector location a list vector river a list vector station a list vector catchment a list vector hydrometricarea a list vector operator a list vector haname a list vector gridreference a list vector stationtype a list vector catchmentarea a list vector gdfstart a list vector gdfend a list vector fartext a list vector categories a list vector altitude a list vector sensitivity a list vector lat a numeric vector lon a numeric vector Region a character vector RecordedYears a numeric vector Details This is the full set of river station that can be retrieved using UK NRFA APIs. Source http://www.ceh.ac.uk/data/nrfa/ data(stationsummary)

Index Topic datasets stationsummary, 10 catalogue, 2 cmr, 4 convert_flow, 5 gdf, 5 get_ts, 6 osg_parse, 7 plot_rain_flow, 8 plot_trend, 9 rnrfa-package, 2 seasonal_averages, 10 stationsummary, 10 12