diff --git a/.Rbuildignore b/.Rbuildignore index 9e2f5e5f1b1f7d96b3a6d0dc9f99457b4e9f2efc..1f8902d7c0b7391ae1688fc71590eaf4b70ac53c 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -4,3 +4,6 @@ ^LICENSE\.md$ ^man-roxygen$ ^docs$ +^\.gitlab-ci\.yml$ +^_pkgdown.yml$ +^pkgdown$ diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f06560e649ccefa5bad76e2abdfba348bc9a84c3..1edc0ec337ec686edfa26599bd4ab08e4d8fed68 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -37,4 +37,4 @@ website: - R -e 'devtools::update_packages(packages = "pkgdown")' - R -e 'pkgdown::build_site()' - sudo apt-get update && sudo apt-get install -y sshpass rsync - - sshpass -p "${OVH_PASS}" rsync -a -e "ssh -o StrictHostKeyChecking=no" docs/ ${OVH_LOGIN}@${OVH_SFTP}:/home/${OVH_LOGIN}/in-wop/bnpe/ + - sshpass -p "${OVH_PASS}" rsync -a -e "ssh -o StrictHostKeyChecking=no" docs/ ${OVH_LOGIN}@${OVH_SFTP}:/home/${OVH_LOGIN}/in-wop/hubeau/ diff --git a/DESCRIPTION b/DESCRIPTION index a3e311a6b792706881851aba610e54b587bb1b0e..5fd965afdfc6eedeeb38a0dabcd94fe9b19937b1 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,17 +1,15 @@ -Package: bnpe +Package: hubeau Type: Package -Title: Retrieval Functions for the French national data bank of quantitative withdrawals (BNPE) +Title: Functions for the French API on water data "Hub'eau" Version: 0.2.0.9000 Authors@R: c( person("David", "Dorchies", role = c("aut", "cre"), comment = c(ORCID = "0000-0002-6595-7984"), email = "david.dorchies@inrae.fr") ) -Description: Collection of functions to help retrieve the French national data bank of - quantitative withdrawals (Banque Nationale des Prélèvements quantitatifs en Eau - BNPE) - available on its website <https://bnpe.eaufrance.fr/>. +Description: Collection of functions to help retrieve the French national data bank on water <https://hubeau.eaufrance.fr/>. License: MIT + file LICENSE Encoding: UTF-8 LazyData: true -Imports: +Imports: config, httr, purrr, diff --git a/NAMESPACE b/NAMESPACE index 8c050acb8e157517437a8c86376636983052174c..c8bd8d5e87878711db092b0fcacb813d1b9ec7fa 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,10 +1,4 @@ # Generated by roxygen2: do not edit by hand -export(doQuery) -export(getComSeriesDep) -export(getCookie) -export(getOuvrageSeries) -export(getTimeSeriesCom) -export(getTimeSeriesDep) -export(get_chronique) -export(get_points_prelevement) +export(get_prelevements_chronique) +export(get_prelevements_prelevement) diff --git a/NEWS.md b/NEWS.md index c451364667bf413b675a07b35ad60009f8c24f8b..6c0f47d272d18a3a9f2d6d4df4ad1c71c83f5ad7 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# bnpe +# hubeau ## 0.2.0 - 2021-06-24 diff --git a/R/doApiQuery.R b/R/doApiQuery.R index 62330f693f27d50b2b7f7d09f883f38f9cc6512d..3b13992ba075e21613d37a63cc3b94cd4affc086 100644 --- a/R/doApiQuery.R +++ b/R/doApiQuery.R @@ -1,6 +1,6 @@ doApiQuery <- function(url_path, params, - cfg = config::get(file = system.file("config.yml", package = "bnpe"))) { + cfg = config::get(file = system.file("config.yml", package = "hubeau"))) { query <- file.path(cfg$api$url, url_path) for (paramName in names(params)) { if (!is.null(params[[paramName]])) { diff --git a/R/doQuery.R b/R/doQuery.R deleted file mode 100644 index fa52508b074795cb4a8ecc16fcfde41410c7539c..0000000000000000000000000000000000000000 --- a/R/doQuery.R +++ /dev/null @@ -1,43 +0,0 @@ -#' Internal function for doing the queries for the bnpe package -#' -#' @param url_path the end of the URL path -#' @param params A list containing the parameters sent in the query -#' @inheritParams getCookie -#' @param cookie a named [character] [vector] with the values of the cookies (See [getCookie]) -#' -#' @return a [httr::response] object from a [httr::GET] -#' @export -#' -doQuery <- function(url_path, - params = list(code_usage = NULL, - code_type_eau = NULL, - commune_adj = NULL, - ecrasant = "false"), - cfg = config::get(file = system.file("config.yml", package = "bnpe")), - cookie = getCookie(cfg)) { - - paramsDef <- list(code_usage = NULL, - code_type_eau = NULL, - commune_adj = NULL, - ecrasant = "false") - params <- utils::modifyList(paramsDef, as.list(params)) - - # Building URL query https://website/?param1=value1¶m2=value2... - query <- file.path(cfg$url, url_path) - for (paramName in names(params)) { - if (!is.null(params[[paramName]])) { - query <- urltools::param_set(query, - key = paramName, - value = params[[paramName]]) - } - } - - # Request - resp <- httr::GET(query, - httr::user_agent(cfg$user_agent), - httr::set_cookies(.cookies = cookie)) - if(length(grep("<title>Request Rejected</title>", httr::content(resp, "text"))) > 0) { - stop("The following URL request has been rejected: ", query) - } - return(resp) -} diff --git a/R/getComSeries.R b/R/getComSeries.R deleted file mode 100644 index e9fb7c079522f87e9f3dc68d363234ed95ef1f89..0000000000000000000000000000000000000000 --- a/R/getComSeries.R +++ /dev/null @@ -1,34 +0,0 @@ -#' Retrieve data by commune for one departement and one year -#' -#' @param code_dep [character] of length 2 -#' @param year [numeric] Year of the data to retrieve -#' @template param_get_common -#' -#' @return [data.frame] with one row by commune and two columns: "insee_com" and "volume" -#' @export -#' -#' @examples -#' getComSeriesDep("08", 2016, code_usage = "AEP", code_type_eau = "CONT") -getComSeriesDep <- function(code_dep, - year, - code_usage = NULL, - code_type_eau = NULL, - cfg = config::get(file = system.file("config.yml", package = "bnpe")), - cookie = getCookie(cfg)) { - params <- list( - code_dep = code_dep, - annee = year, - code_usage = code_usage, - code_type_eau = code_type_eau - ) - - resp <- doQuery(url_path = cfg$url_com_series, - params = params, - cfg = cfg, - cookie = cookie) - l <- httr::content(resp, "parsed") - codesInsee <- sapply(l$features, function(x) { x$properties$codeInsee }) - hasVolume <- sapply(l$features, function(x) { !is.null(x$properties$volume) }) - volumes <- unlist(sapply(l$features, function(x) { x$properties$volume })) - data.frame(insee_com = codesInsee[hasVolume], volume = volumes) -} diff --git a/R/getCookie.R b/R/getCookie.R deleted file mode 100644 index 7caa2a0b7220b8f52b22e170f93d1c7bd58602e6..0000000000000000000000000000000000000000 --- a/R/getCookie.R +++ /dev/null @@ -1,23 +0,0 @@ -#' Get cookie from the BNPE website in order to be able to do requests -#' -#' By default it is automatically called at each request but this function -#' can be used once to store a unique cookie and avoiding asking a cookie for each request (See example). -#' -#' @param cfg a [config] object Configuration of the communication. Use by default the internal package -#' configuration stored at location `system.file("config.yml", package = "bnpe")` -#' -#' @return a named [character] [vector] with the values of the cookies -#' @export -#' -#' @examples -#' cookie <- getCookie() -#' getTimeSeriesDep("08", cookie = cookie) -#' getTimeSeriesCom("08105", cookie = cookie) -getCookie <- function(cfg = config::get(file = system.file("config.yml", package = "bnpe"))) { - URL1 <- paste0(urltools::scheme(cfg$url), "://", urltools::domain(cfg$url)) - userAgent <- httr::user_agent(cfg$user_agent) - resp <- httr::GET(URL1, userAgent) - ck <- httr::cookies(resp)$value - names(ck) <- httr::cookies(resp)$name - return(ck) -} diff --git a/R/getOuvrageSeries.R b/R/getOuvrageSeries.R deleted file mode 100644 index 95b31af0a5eea2ba4c58d4268e5781939bb4f673..0000000000000000000000000000000000000000 --- a/R/getOuvrageSeries.R +++ /dev/null @@ -1,63 +0,0 @@ -#' Retrieve data by device ("ouvrage") (metadata and annual withdrawal volumes) -#' -#' @param code_sandre [character] Sandre identifier of the device -#' @param cookie a named [character] [vector] with the values of the cookies (See [getCookie]) -#' @inheritParams getCookie -#' -#' @return [list] compiling data of the device with the following items: -#' - `id`: BNPE identifier -#' - `code`: code Sandre -#' - `codeCommune`: insee code of the commune -#' - `codePrecision`: ??? -#' - `codeStatut`: ??? -#' - `codeTypeEau`: the withdrawal source which can take the following values: -#' - "CONT" for continental surface -#' - "SOUT" for subsurface -#' - "LIT" for littoral -#' - `codeUsage`: a numeric code related to water destination: energy, canals, turbined, AEP, industry or irrigation -#' - `commentaire`: comment -#' - `exploitationDebut`: start date of the -#' -#' @export -#' -#' @examples -#' getOuvrageSeries("OPR0000200109") -getOuvrageSeries <- function(code_sandre, - cfg = config::get(file = system.file("config.yml", - package = "bnpe")), - cookie = getCookie(cfg)) { - params <- list( - code = code_sandre - ) - - resp <- doQuery(url_path = cfg$url_ouvrage, - params = params, - cfg = cfg, - cookie = cookie) - l <- httr::content(resp, "parsed")[[1]] - - l$exploitationDebut <- as.Date( - format( - as.POSIXct(l$exploitationDebut / 1000, origin = "1970-01-01", tz = "CET") - ) - ) - - params <- list( - code_ouvrage = code_sandre, - ecrasant = "false" - ) - - resp <- doQuery(url_path = cfg$url_ouv_series, - params = params, - cfg = cfg, - cookie = cookie) - lTS <- httr::content(resp, "parsed") - hasVolume <- sapply(lTS, function(x) { !is.null(x$volume) }) - annees <- sapply(lTS, "[[", "annee") - volumes <- unlist(sapply(lTS, "[[", "volume")) - peuplements <- unlist(sapply(lTS, "[[", "peuplement")) - l$TS <- data.frame(annee = annees[hasVolume], - volume = volumes, - peuplement = peuplements[hasVolume]) - return(l) -} diff --git a/R/getTimeSeries.R b/R/getTimeSeries.R deleted file mode 100644 index b09d5836c2a8ed4b07d27ce991b22b933a9864cd..0000000000000000000000000000000000000000 --- a/R/getTimeSeries.R +++ /dev/null @@ -1,78 +0,0 @@ -#' Get withdrawal time series for a geographical entity -#' @param insee_com a [character] of length 5 representing the INSEE code of the commune -#' @template param_get_common -#' -#' @return a [data.frame] with one year by row and the following columns: -#' - "volume" the withdrawal annual volume in cubic meters -#' - "annee" the year -#' - "peuplement" a unknown code -#' @export -#' @rdname getTimeSeries -#' -#' @examples -#' # Withdrawal time series for Ardennes department -#' getTimeSeriesDep("08") -#' -#' # Withdrawal time series for the commune of Charleville-Mézières -#' getTimeSeriesCom("08105") -#' -getTimeSeriesCom <- function(insee_com, - code_usage = NULL, - code_type_eau = NULL, - cfg = config::get(file = system.file("config.yml", package = "bnpe")), - cookie = getCookie(cfg)) { - getTimeSeries(level = "commune", - id_name = "insee_com", - id_value = insee_com, - commune_adj = "false", - cfg = cfg, - cookie = cookie) - } - -#' @param insee_dep a [character] of length 2 representing the INSEE code of the commune -#' @rdname getTimeSeries -#' @export -getTimeSeriesDep <- function(insee_dep, - code_usage = NULL, - code_type_eau = NULL, - cfg = config::get(file = system.file("config.yml", package = "bnpe")), - cookie = getCookie(cfg)) { - getTimeSeries(level ="departement", - id_name = "code_dep", - id_value = insee_dep, - code_usage = code_usage, - code_type_eau = code_type_eau, - cfg = cfg, - cookie = cookie) -} - - -#' @param level [character] geographical level ("commune", "departement", ...) -#' @param id_name geographical identifier name ("insee_com", "code_dep", ...) -#' @param id_value geographical identifier value ("08105", "08", ...) -#' @inherit getTimeSeries -#' @noRd -getTimeSeries <- - function(level, - id_name, - id_value, - code_usage = NULL, - code_type_eau = NULL, - commune_adj = NULL, - cfg = config::get(file = system.file("config.yml", package = "bnpe")), - cookie = getCookie(cfg)) { - - params <- list( - id = id_value, - code_usage = code_usage, - code_type_eau = code_type_eau, - commune_adj = commune_adj - ) - names(params)[names(params) == "id"] <- id_name - - resp <- doQuery(url_path = paste(cfg$url_time_series, level, sep = "_"), - params = params, cfg = cfg, cookie = cookie) - - # return a data.frame - do.call(rbind, httr::content(resp, "parsed")) - } diff --git a/R/get_chronique.R b/R/get_prelevements_chronique.R similarity index 75% rename from R/get_chronique.R rename to R/get_prelevements_chronique.R index c85cfcdbe20227d0b8911556c039f900c6ff74d2..640943a025686fb81c660d8ce0d56a5e5dd505bb 100644 --- a/R/get_chronique.R +++ b/R/get_prelevements_chronique.R @@ -3,17 +3,18 @@ #' See the API documentation for available filter parameters: \url{https://hubeau.eaufrance.fr/page/api-prelevements-eau#/prelevements/chronique} #' #' @param params [list] where the keys are the names of the filtered parameters and the values are the values of the filters. See the API documentation for the complete list of available filter parameters -#' @inheritParams getCookie +#' @param cfg a [config] object Configuration of the communication. Use by default the internal package +#' configuration #' #' @return a [tibble::tibble] with all available parameters in columns and one row by device, year and usage. #' @export #' #' @examples #' # For retrieving the withdrawal time series of the devices located in Romilly-sur-Seine -#' get_chronique(list(code_commune_insee = "10323")) +#' get_prelevements_chronique(list(code_commune_insee = "10323")) #' -get_chronique <- function(params, cfg = config::get(file = system.file("config.yml", - package = "bnpe"))) { +get_prelevements_chronique <- function(params, cfg = config::get(file = system.file("config.yml", + package = "hubeau"))) { l <- doApiQuery(cfg$api_prelevements$chronique, params) l <- lapply(l, function(x) { x$geometry <- NULL diff --git a/R/get_points_prelevement.R b/R/get_prelevements_prelevement.R similarity index 73% rename from R/get_points_prelevement.R rename to R/get_prelevements_prelevement.R index 3092a6d096525cb75aa811a9f433a7a0f193d074..8b274dbab4662fff0b0577df3249c834e6f293b1 100644 --- a/R/get_points_prelevement.R +++ b/R/get_prelevements_prelevement.R @@ -3,17 +3,18 @@ #' See the API documentation for available filter parameters: \url{https://hubeau.eaufrance.fr/page/api-prelevements-eau#/prelevements/prelevement} #' #' @param params [list] where the keys are the names of the filtered parameters and the values are the values of the filters. See the API documentation for the complete list of available filter parameters -#' @inheritParams getCookie +#' @param cfg a [config] object Configuration of the communication. Use by default the internal package +#' configuration #' #' @return a [tibble::tibble] with all available parameters in columns and one row by device. #' @export #' #' @examples #' # For retrieving the withdrawal points located in Romilly-sur-Seine -#' get_points_prelevement(list(code_commune_insee = "10323")) +#' get_prelevements_prelevement(list(code_commune_insee = "10323")) #' -get_points_prelevement <- function(params, cfg = config::get(file = system.file("config.yml", - package = "bnpe"))) { +get_prelevements_prelevement <- function(params, cfg = config::get(file = system.file("config.yml", + package = "hubeau"))) { l <- doApiQuery(cfg$api_prelevements$points_prelevement, params) l <- lapply(l, function(row) {lapply(row, function(cell) { if(is.null(unlist(cell))) NA else unlist(cell) })}) return(purrr::map_df(l, tibble::as_tibble)) diff --git a/README.Rmd b/README.Rmd index 34710d7adb488a10a7219db100caf02b5a7f7d2c..c51a711ffb9b464757abd441e11cceeae889bb3a 100644 --- a/README.Rmd +++ b/README.Rmd @@ -13,38 +13,36 @@ knitr::opts_chunk$set( ) ``` -# bnpe +# hubeau <!-- badges: start --> `r badger::badge_license(color = "orange")` `r badger::badge_lifecycle("experimental", color = "blue")` <!-- badges: end --> -'bnpe' is an R-package proposing a collection of function to help retrieve the French national data bank of quantitative withdrawals (Banque Nationale des Prélèvements quantitatifs en Eau - BNPE) available on its website https://bnpe.eaufrance.fr and on https://hubeau.eaufrance.fr/page/api-prelevements-eau +'hubeau' is an R-package proposing a collection of function to help retrieve the French national data bank of quantitative withdrawals (Banque Nationale des Prélèvements quantitatifs en Eau - BNPE) available on its website https://hubeau.eaufrance.fr and on https://hubeau.eaufrance.fr/page/api-prelevements-eau ## Installation -You can install the bnpe R-package from it's development repository with: +You can install the hubeau R-package from it's development repository with: ``` r install.packages("remotes") -remotes::install_gitlab("in-wop/bnpe", host = "gitlab.irstea.fr") +remotes::install_gitlab("in-wop/hubeau", host = "gitlab.irstea.fr") ``` -## Get started - -### Loading library +## Loading library ```{r library} -library(bnpe) +library(hubeau) ``` -### Loading data from the Hub'Eau API +## Loading data from the Hub'Eau API Two functions are available: -- `get_points_prelevement`: retrieve data about abstraction points -- `get_chronique`: retrieve annual volume time series and characteristics +- `get_prelevements_prelevement`: retrieve data about abstraction points +- `get_prelevements_chronique`: retrieve annual volume time series and characteristics The available filters for these functions are detailed in the API documentation respectively: https://hubeau.eaufrance.fr/page/api-prelevements-eau#/prelevements/prelevement and https://hubeau.eaufrance.fr/page/api-prelevements-eau#/prelevements/chronique @@ -52,56 +50,14 @@ Examples: ```{r} # Characteristics of surface abstraction points in the Ardennes departement -pp08 <- get_points_prelevement(list(code_departement = "08", code_type_milieu = "CONT")) +pp08 <- get_prelevements_prelevement(list(code_departement = "08", code_type_milieu = "CONT")) str(pp08) # Time series of annual abstracted volumes for drinking water supply from surface water in the Ardennes departement # As the parameter "source of the water" (ground, surface...) is not available here, we can use the list of abstraction points previously downloaded as filter: -dfAEP <- get_chronique(list(code_ouvrage = paste(pp08$code_ouvrage, collapse = ","), +dfAEP <- get_prelevements_chronique(list(code_ouvrage = paste(pp08$code_ouvrage, collapse = ","), code_usage = "AEP")) str(dfAEP) ``` -### Scrapping aggregated data from the BNPE website - -Functions for getting time series are: - -- `getTimeSeriesDep`: for one department -- `getTimeSeriesCom`: for one commune - -These functions uses the French official geographical codification (https://fr.wikipedia.org/wiki/Code_officiel_g%C3%A9ographique). - -Type `?getTimeSeriesCom` for getting help. - -Examples: - -```{r timeseries} -# Time series for all type of withdrawal sources and destinations in the Ardennes departement -getTimeSeriesDep("08") - -# Time series for drinking water withdrawals in surface water bodies in the Ardennes department -getTimeSeriesDep("08", code_usage = "AEP", code_type_eau = "CONT") - -# Withdrawal time series for the commune of Charleville-Mézières -getTimeSeriesCom("08105") -``` - -### Communal data in one departement - -For getting list of communes of departement with corresponding withdrawal volumes for one year, use the function `getComSeriesDep` as follow: - -```{r} -# All source and destination withdrawals for the year 2016 in the Ardennes departement -getComSeriesDep("08", 2016, code_usage = "AEP", code_type_eau = "CONT") -``` - -### Properties and time series from one device ("ouvrage") - -For getting metadata and withdrawal yearly time series from on device identified by its "code Sandre" (See https://www.sandre.eaufrance.fr/atlas/srv/fre/catalog.search#/metadata/e315633f-0930-41e8-a1c4-61fb2303039c): - -```{r} -# metadata and timeseries from withdrawal "COPRIMANCHE-forage LD LE PACO (40m)" -ouvrage <- getOuvrageSeries("OPR0000200109") -str(ouvrage) -``` diff --git a/README.md b/README.md index 5e5a9be468230b9af1d8a7387046597e2adde160..46f609586663bf018a5d158b94bc49ec617451c8 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ <!-- README.md is generated from README.Rmd. Please edit that file --> -# bnpe +# hubeau <!-- badges: start --> @@ -10,36 +10,35 @@ MIT](https://img.shields.io/badge/license-MIT-orange.svg)](https://cran.r-projec [](https://lifecycle.r-lib.org/articles/stages.html#experimental) <!-- badges: end --> -‘bnpe’ is an R-package proposing a collection of function to help +‘hubeau’ is an R-package proposing a collection of function to help retrieve the French national data bank of quantitative withdrawals (Banque Nationale des Prélèvements quantitatifs en Eau - BNPE) available -on its website <https://bnpe.eaufrance.fr> and on +on its website <https://hubeau.eaufrance.fr> and on <https://hubeau.eaufrance.fr/page/api-prelevements-eau> ## Installation -You can install the bnpe R-package from it’s development repository +You can install the hubeau R-package from it’s development repository with: ``` r install.packages("remotes") -remotes::install_gitlab("in-wop/bnpe", host = "gitlab.irstea.fr") +remotes::install_gitlab("in-wop/hubeau", host = "gitlab.irstea.fr") ``` -## Get started - -### Loading library +## Loading library ``` r -library(bnpe) +library(hubeau) ``` -### Loading data from the Hub’Eau API +## Loading data from the Hub’Eau API Two functions are available: -- `get_points_prelevement`: retrieve data about abstraction points -- `get_chronique`: retrieve annual volume time series and +- `get_prelevements_prelevement`: retrieve data about abstraction + points +- `get_prelevements_chronique`: retrieve annual volume time series and characteristics The available filters for these functions are detailed in the API @@ -52,7 +51,7 @@ Examples: ``` r # Characteristics of surface abstraction points in the Ardennes departement -pp08 <- get_points_prelevement(list(code_departement = "08", code_type_milieu = "CONT")) +pp08 <- get_prelevements_prelevement(list(code_departement = "08", code_type_milieu = "CONT")) str(pp08) #> tibble [85 x 28] (S3: tbl_df/tbl/data.frame) #> $ code_point_prelevement : chr [1:85] "PTP000000000005792" "PTP000000000005793" "PTP000000000005794" "PTP000000000005795" ... @@ -86,7 +85,7 @@ str(pp08) # Time series of annual abstracted volumes for drinking water supply from surface water in the Ardennes departement # As the parameter "source of the water" (ground, surface...) is not available here, we can use the list of abstraction points previously downloaded as filter: -dfAEP <- get_chronique(list(code_ouvrage = paste(pp08$code_ouvrage, collapse = ","), +dfAEP <- get_prelevements_chronique(list(code_ouvrage = paste(pp08$code_ouvrage, collapse = ","), code_usage = "AEP")) str(dfAEP) #> tibble [40 x 23] (S3: tbl_df/tbl/data.frame) @@ -114,115 +113,3 @@ str(dfAEP) #> $ nom_ouvrage : chr [1:40] "COMMUNE DE GIVET" "COMMUNE DE GIVET" "COMMUNE DE GIVET" "COMMUNE DE GIVET" ... #> $ uri_ouvrage : chr [1:40] "https://id.eaufrance.fr/OuvragePrel/OPR0000000767" "https://id.eaufrance.fr/OuvragePrel/OPR0000000767" "https://id.eaufrance.fr/OuvragePrel/OPR0000000767" "https://id.eaufrance.fr/OuvragePrel/OPR0000000767" ... ``` - -### Scrapping aggregated data from the BNPE website - -Functions for getting time series are: - -- `getTimeSeriesDep`: for one department -- `getTimeSeriesCom`: for one commune - -These functions uses the French official geographical codification -(<https://fr.wikipedia.org/wiki/Code_officiel_g%C3%A9ographique>). - -Type `?getTimeSeriesCom` for getting help. - -Examples: - -``` r -# Time series for all type of withdrawal sources and destinations in the Ardennes departement -getTimeSeriesDep("08") -#> volume annee peuplement -#> [1,] NULL "2008" "2" -#> [2,] NULL "2009" "2" -#> [3,] NULL "2010" "2" -#> [4,] NULL "2011" "2" -#> [5,] 750878007 "2012" "1" -#> [6,] 1070936432 "2013" "1" -#> [7,] 930232502 "2014" "1" -#> [8,] 918264038 "2015" "1" -#> [9,] 899230351 "2016" "1" -#> [10,] 790975515 "2017" "1" -#> [11,] 324131543 "2018" "1" -#> [12,] 163293169 "2019" "3" - -# Time series for drinking water withdrawals in surface water bodies in the Ardennes department -getTimeSeriesDep("08", code_usage = "AEP", code_type_eau = "CONT") -#> volume annee peuplement -#> [1,] NULL "2008" "2" -#> [2,] NULL "2009" "2" -#> [3,] NULL "2010" "2" -#> [4,] NULL "2011" "2" -#> [5,] 506356 "2012" "1" -#> [6,] 479622 "2013" "1" -#> [7,] 599626 "2014" "1" -#> [8,] 631363 "2015" "1" -#> [9,] 581305 "2016" "1" -#> [10,] 1134831 "2017" "1" -#> [11,] 504790 "2018" "1" -#> [12,] 380556 "2019" "3" - -# Withdrawal time series for the commune of Charleville-Mézières -getTimeSeriesCom("08105") -#> volume annee peuplement -#> [1,] NULL "2008" "2" -#> [2,] NULL "2009" "2" -#> [3,] NULL "2010" "2" -#> [4,] NULL "2011" "2" -#> [5,] 55898 "2012" "1" -#> [6,] 15359 "2013" "1" -#> [7,] 79086 "2014" "1" -#> [8,] 100624 "2015" "1" -#> [9,] 16359 "2016" "1" -#> [10,] 17162 "2017" "1" -#> [11,] 67910 "2018" "1" -#> [12,] 512130 "2019" "1" -``` - -### Communal data in one departement - -For getting list of communes of departement with corresponding -withdrawal volumes for one year, use the function `getComSeriesDep` as -follow: - -``` r -# All source and destination withdrawals for the year 2016 in the Ardennes departement -getComSeriesDep("08", 2016, code_usage = "AEP", code_type_eau = "CONT") -#> insee_com volume -#> 1 08096 33024 -#> 2 08135 13583 -#> 3 08247 439424 -#> 4 08420 95274 -``` - -### Properties and time series from one device (“ouvrageâ€) - -For getting metadata and withdrawal yearly time series from on device -identified by its “code Sandre†(See -<https://www.sandre.eaufrance.fr/atlas/srv/fre/catalog.search#/metadata/e315633f-0930-41e8-a1c4-61fb2303039c>): - -``` r -# metadata and timeseries from withdrawal "COPRIMANCHE-forage LD LE PACO (40m)" -ouvrage <- getOuvrageSeries("OPR0000200109") -str(ouvrage) -#> List of 12 -#> $ id : int 200108 -#> $ code : chr "OPR0000200109" -#> $ codeCommune : chr "50151" -#> $ codePrecision : int 1 -#> $ codeStatut : chr "Validé" -#> $ codeTypeEau : chr "SOUT" -#> $ codeUsage : chr "4" -#> $ commentaire : chr "" -#> $ exploitationDebut: Date[1:1], format: "1987-01-01" -#> $ geom :List of 2 -#> ..$ type : chr "Point" -#> ..$ coordinates:List of 2 -#> .. ..$ : num -1.58 -#> .. ..$ : num 49.2 -#> $ ouvNom : chr "COPRIMANCHE-forage LD LE PACO (40m)" -#> $ TS :'data.frame': 6 obs. of 3 variables: -#> ..$ annee : chr [1:6] "2013" "2014" "2015" "2016" ... -#> ..$ volume : int [1:6] 101970 84430 85220 87820 106219 118124 -#> ..$ peuplement: chr [1:6] "1" "1" "1" "1" ... -``` diff --git a/_pkgdown.yml b/_pkgdown.yml index 1ac320b60baf97094047a1423c59d706f0603966..4a5c656c683cf8db9736de22d1183aff1995369c 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -1,4 +1,4 @@ -url: https://in-wop.g-eau.fr/bnpe +url: https://in-wop.g-eau.fr/hubeau development: mode: unreleased @@ -13,10 +13,10 @@ navbar: github: ~ gitlab: icon: fab fa-gitlab fa-lg - href: https://gitlab.irstea.fr/in-wop/bnpe + href: https://gitlab.irstea.fr/in-wop/hubeau repo: url: - home: https://gitlab.irstea.fr/in-wop/bnpe/ - source: https://gitlab.irstea.fr/in-wop/bnpe/-/blob/master/ - issue: https://gitlab.irstea.fr/in-wop/bnpe/-/issues/ + home: https://gitlab.irstea.fr/in-wop/hubeau/ + source: https://gitlab.irstea.fr/in-wop/hubeau/-/blob/master/ + issue: https://gitlab.irstea.fr/in-wop/hubeau/-/issues/ diff --git a/bnpe.Rproj b/hubeau.Rproj similarity index 100% rename from bnpe.Rproj rename to hubeau.Rproj diff --git a/man/doQuery.Rd b/man/doQuery.Rd deleted file mode 100644 index 0ad7f030db6b86156d14cd8c6f34b32124b3e3f2..0000000000000000000000000000000000000000 --- a/man/doQuery.Rd +++ /dev/null @@ -1,30 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/doQuery.R -\name{doQuery} -\alias{doQuery} -\title{Internal function for doing the queries for the bnpe package} -\usage{ -doQuery( - url_path, - params = list(code_usage = NULL, code_type_eau = NULL, commune_adj = NULL, ecrasant = - "false"), - cfg = config::get(file = system.file("config.yml", package = "bnpe")), - cookie = getCookie(cfg) -) -} -\arguments{ -\item{url_path}{the end of the URL path} - -\item{params}{A list containing the parameters sent in the query} - -\item{cfg}{a \link{config} object Configuration of the communication. Use by default the internal package -configuration stored at location \code{system.file("config.yml", package = "bnpe")}} - -\item{cookie}{a named \link{character} \link{vector} with the values of the cookies (See \link{getCookie})} -} -\value{ -a \link[httr:response]{httr::response} object from a \link[httr:GET]{httr::GET} -} -\description{ -Internal function for doing the queries for the bnpe package -} diff --git a/man/figures/logo.svg b/man/figures/logo.svg new file mode 100644 index 0000000000000000000000000000000000000000..03f462c0a05f5b8d4b2a184ad513732a6edbbbd5 --- /dev/null +++ b/man/figures/logo.svg @@ -0,0 +1,66 @@ +<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="171.865" height="88.512" viewBox="0 0 171.865 88.512"> + <defs> + <filter id="Tracé_1" x="0" y="12.523" width="66.782" height="75.99" filterUnits="userSpaceOnUse"> + <feOffset dy="3" input="SourceAlpha"/> + <feGaussianBlur stdDeviation="3" result="blur"/> + <feFlood flood-opacity="0.161"/> + <feComposite operator="in" in2="blur"/> + <feComposite in="SourceGraphic"/> + </filter> + <filter id="Tracé_2" x="69.293" y="11.309" width="24.756" height="28.951" filterUnits="userSpaceOnUse"> + <feOffset dy="3" input="SourceAlpha"/> + <feGaussianBlur stdDeviation="3" result="blur-2"/> + <feFlood flood-opacity="0.161"/> + <feComposite operator="in" in2="blur-2"/> + <feComposite in="SourceGraphic"/> + </filter> + <filter id="Tracé_3" x="16.634" y="0" width="65.561" height="64.799" filterUnits="userSpaceOnUse"> + <feOffset dy="3" input="SourceAlpha"/> + <feGaussianBlur stdDeviation="3" result="blur-3"/> + <feFlood flood-opacity="0.161"/> + <feComposite operator="in" in2="blur-3"/> + <feComposite in="SourceGraphic"/> + </filter> + <filter id="Tracé_4" x="79.737" y="22.855" width="40.853" height="41.767" filterUnits="userSpaceOnUse"> + <feOffset dy="3" input="SourceAlpha"/> + <feGaussianBlur stdDeviation="3" result="blur-4"/> + <feFlood flood-opacity="0.161"/> + <feComposite operator="in" in2="blur-4"/> + <feComposite in="SourceGraphic"/> + </filter> + <filter id="Tracé_5" x="105.169" y="22.855" width="40.853" height="41.767" filterUnits="userSpaceOnUse"> + <feOffset dy="3" input="SourceAlpha"/> + <feGaussianBlur stdDeviation="3" result="blur-5"/> + <feFlood flood-opacity="0.161"/> + <feComposite operator="in" in2="blur-5"/> + <feComposite in="SourceGraphic"/> + </filter> + <filter id="Tracé_6" x="133.523" y="23.221" width="38.342" height="41.401" filterUnits="userSpaceOnUse"> + <feOffset dy="3" input="SourceAlpha"/> + <feGaussianBlur stdDeviation="3" result="blur-6"/> + <feFlood flood-opacity="0.161"/> + <feComposite operator="in" in2="blur-6"/> + <feComposite in="SourceGraphic"/> + </filter> + </defs> + <g id="Groupe_1" data-name="Groupe 1" transform="translate(9 6)"> + <g transform="matrix(1, 0, 0, 1, -9, -6)" filter="url(#Tracé_1)"> + <path id="Tracé_1-2" data-name="Tracé 1" d="M46.075,70.817a2,2,0,0,0-2.65,0l-4.831,4.832a1.743,1.743,0,1,0,2.466,2.466L43.1,76.076V80.2c-.093.836-1.065,7.787-7.554,7.787-7.341,0-7.773-7.625-7.774-7.7V56.966l-.007-.16c-.352-3.814-3.111-11.028-11.035-11.028a10.2,10.2,0,0,0-7.773,3.309V35.224a1.743,1.743,0,0,0-3.486,0V66.319a4.577,4.577,0,1,0,3.486,0V57.078c.122-.892,1.278-7.812,7.773-7.812,6.453,0,7.46,6.977,7.556,7.794V80.285c0,2.363,1.911,11.186,11.261,11.186,7.922,0,10.681-7.212,11.034-11.026l0-4.189,1.858,1.859a1.744,1.744,0,0,0,2.466-2.466Z" transform="translate(6.37 -14.96)" fill="#0C72B9"/> + </g> + <g transform="matrix(1, 0, 0, 1, -9, -6)" filter="url(#Tracé_2)"> + <path id="Tracé_2-2" data-name="Tracé 2" d="M175.4,30.788a2.768,2.768,0,0,0-2.144-.051,2.7,2.7,0,0,0-1.614,1.41,2.636,2.636,0,0,0-.13,2.086,2.512,2.512,0,0,0,.966,1.311,14.844,14.844,0,0,1-.758,2.079,7.618,7.618,0,0,1-1.083,1.795,1.5,1.5,0,0,0-.414.85A1.041,1.041,0,0,0,170.4,41a1.236,1.236,0,0,0,.633.433,1.406,1.406,0,0,0,.923-.034,4.927,4.927,0,0,0,1.648-1.222,13.324,13.324,0,0,0,1.832-2.336,12.125,12.125,0,0,0,1.3-2.8,4.147,4.147,0,0,0,.057-2.63A2.633,2.633,0,0,0,175.4,30.788Z" transform="translate(-91.93 -13.24)" fill="#0C72B9"/> + </g> + <g transform="matrix(1, 0, 0, 1, -9, -6)" filter="url(#Tracé_3)"> + <path id="Tracé_3-2" data-name="Tracé 3" d="M78.558,26.263a11.828,11.828,0,0,0-8.406,3.5V14.383l-.012-.2c-.438-3.8-3.354-10.988-11.249-10.988-7.922,0-10.682,7.213-11.034,11.028l0,1.6L45.84,13.812a1.744,1.744,0,0,0-2.466,2.466l4.831,4.832a1.738,1.738,0,0,0,1.233.511c.031,0,.061-.007.092-.009s.061.009.092.009a1.737,1.737,0,0,0,1.233-.511l4.831-4.832a1.744,1.744,0,0,0-2.466-2.466L51.337,15.7V14.471c.093-.837,1.065-7.79,7.554-7.79,6.443,0,7.645,6.916,7.774,7.815V37.7a1.744,1.744,0,0,0,.03.3c0,.045,0,.088,0,.133A11.866,11.866,0,1,0,78.558,26.263Zm0,20.243a8.378,8.378,0,1,1,8.38-8.376A8.387,8.387,0,0,1,78.558,46.507Z" transform="translate(-17.23 2.81)" fill="#0C72B9"/> + </g> + <g transform="matrix(1, 0, 0, 1, -9, -6)" filter="url(#Tracé_4)"> + <path id="Tracé_4-2" data-name="Tracé 4" d="M206.906,58.47a10.994,10.994,0,0,0-8.386,3.458,12.04,12.04,0,0,0-3.041,8.425,11.836,11.836,0,0,0,3.179,8.427,11.19,11.19,0,0,0,8.476,3.457A11,11,0,0,0,213.84,80.3a11.172,11.172,0,0,0,3.8-5.068l.054-.14h-3.957l-.029.055a6.837,6.837,0,0,1-6.529,3.78,7.657,7.657,0,0,1-5.5-2.071,8.194,8.194,0,0,1-2.466-5.028h19.117V70.353a12.04,12.04,0,0,0-3.041-8.426A10.994,10.994,0,0,0,206.906,58.47Zm0,3.312a7.489,7.489,0,0,1,5.226,1.936,8.015,8.015,0,0,1,2.416,4.706H199.265a8.009,8.009,0,0,1,2.415-4.706A7.489,7.489,0,0,1,206.906,61.782Z" transform="translate(-106.74 -29.61)" fill="#0C72B9"/> + </g> + <g transform="matrix(1, 0, 0, 1, -9, -6)" filter="url(#Tracé_5)"> + <path id="Tracé_5-2" data-name="Tracé 5" d="M276.208,62.312a9.187,9.187,0,0,0-7.842-3.842,10.757,10.757,0,0,0-8.341,3.459,13.193,13.193,0,0,0,0,16.849,10.492,10.492,0,0,0,8.113,3.458,9.4,9.4,0,0,0,8.069-3.8v3.43h3.631V58.836h-3.631Zm-7.613,16.613a7.513,7.513,0,0,1-5.858-2.522,9.692,9.692,0,0,1,0-12.1,7.516,7.516,0,0,1,5.858-2.523A7.162,7.162,0,0,1,274.36,64.3a10.035,10.035,0,0,1,0,12.1A7.159,7.159,0,0,1,268.594,78.925Z" transform="translate(-142.82 -29.61)" fill="#0C72B9"/> + </g> + <g transform="matrix(1, 0, 0, 1, -9, -6)" filter="url(#Tracé_6)"> + <path id="Tracé_6-2" data-name="Tracé 6" d="M342.27,59.354V72.607a6.648,6.648,0,0,1-1.977,4.948,6.744,6.744,0,0,1-4.814,1.889,6,6,0,0,1-4.537-1.84,6.918,6.918,0,0,1-1.752-4.951v-13.3h-3.631v13.39a9.986,9.986,0,0,0,2.86,7.423,8.093,8.093,0,0,0,2.913,1.943,11,11,0,0,0,3.964.646,7.5,7.5,0,0,0,4.12-1.158,11.633,11.633,0,0,0,2.855-2.569V82.39H345.9V59.354Z" transform="translate(-183.04 -30.13)" fill="#0C72B9"/> + </g> + </g> +</svg> diff --git a/man/getComSeriesDep.Rd b/man/getComSeriesDep.Rd deleted file mode 100644 index 5ac90e088053e8192ba12bb7904e428d84388165..0000000000000000000000000000000000000000 --- a/man/getComSeriesDep.Rd +++ /dev/null @@ -1,47 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/getComSeries.R -\name{getComSeriesDep} -\alias{getComSeriesDep} -\title{Retrieve data by commune for one departement and one year} -\usage{ -getComSeriesDep( - code_dep, - year, - code_usage = NULL, - code_type_eau = NULL, - cfg = config::get(file = system.file("config.yml", package = "bnpe")), - cookie = getCookie(cfg) -) -} -\arguments{ -\item{code_dep}{\link{character} of length 2} - -\item{year}{\link{numeric} Year of the data to retrieve} - -\item{code_usage}{a \code{\link[=character]{character()}} representing the withdrawal destination which can take the following values: -- "ENE" for energy -- "CAN" for artificial canals -- "BAR" for turbined water (dam) -- "AEP" for drinking water -- "IND" for industry -- "IRR" for irrigation} - -\item{code_type_eau}{a \code{\link[=character]{character()}} representing the withdrawal source which can take the following values: -- "CONT" for continental surface -- "SOUT" for subsurface -- "LIT" for littoral} - -\item{cfg}{a \link{config} object Configuration of the communication. Use by default the internal package -configuration stored at location \code{system.file("config.yml", package = "bnpe")}} - -\item{cookie}{a named \link{character} \link{vector} with the values of the cookies (See \link{getCookie})} -} -\value{ -\link{data.frame} with one row by commune and two columns: "insee_com" and "volume" -} -\description{ -Retrieve data by commune for one departement and one year -} -\examples{ -getComSeriesDep("08", 2016, code_usage = "AEP", code_type_eau = "CONT") -} diff --git a/man/getCookie.Rd b/man/getCookie.Rd deleted file mode 100644 index eacdf92e77ed55e832ea574b31fc775c0b2bb0da..0000000000000000000000000000000000000000 --- a/man/getCookie.Rd +++ /dev/null @@ -1,26 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/getCookie.R -\name{getCookie} -\alias{getCookie} -\title{Get cookie from the BNPE website in order to be able to do requests} -\usage{ -getCookie( - cfg = config::get(file = system.file("config.yml", package = "bnpe")) -) -} -\arguments{ -\item{cfg}{a \link{config} object Configuration of the communication. Use by default the internal package -configuration stored at location \code{system.file("config.yml", package = "bnpe")}} -} -\value{ -a named \link{character} \link{vector} with the values of the cookies -} -\description{ -By default it is automatically called at each request but this function -can be used once to store a unique cookie and avoiding asking a cookie for each request (See example). -} -\examples{ -cookie <- getCookie() -getTimeSeriesDep("08", cookie = cookie) -getTimeSeriesCom("08105", cookie = cookie) -} diff --git a/man/getOuvrageSeries.Rd b/man/getOuvrageSeries.Rd deleted file mode 100644 index 17f3ed8cc43218e181953d9ed959fe6303914848..0000000000000000000000000000000000000000 --- a/man/getOuvrageSeries.Rd +++ /dev/null @@ -1,43 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/getOuvrageSeries.R -\name{getOuvrageSeries} -\alias{getOuvrageSeries} -\title{Retrieve data by device ("ouvrage") (metadata and annual withdrawal volumes)} -\usage{ -getOuvrageSeries( - code_sandre, - cfg = config::get(file = system.file("config.yml", package = "bnpe")), - cookie = getCookie(cfg) -) -} -\arguments{ -\item{code_sandre}{\link{character} Sandre identifier of the device} - -\item{cfg}{a \link{config} object Configuration of the communication. Use by default the internal package -configuration stored at location \code{system.file("config.yml", package = "bnpe")}} - -\item{cookie}{a named \link{character} \link{vector} with the values of the cookies (See \link{getCookie})} -} -\value{ -\link{list} compiling data of the device with the following items: -\itemize{ -\item \code{id}: BNPE identifier -\item \code{code}: code Sandre -\item \code{codeCommune}: insee code of the commune -\item \code{codePrecision}: ??? -\item \code{codeStatut}: ??? -\item \code{codeTypeEau}: the withdrawal source which can take the following values: -- "CONT" for continental surface -- "SOUT" for subsurface -- "LIT" for littoral -\item \code{codeUsage}: a numeric code related to water destination: energy, canals, turbined, AEP, industry or irrigation -\item \code{commentaire}: comment -\item \code{exploitationDebut}: start date of the -} -} -\description{ -Retrieve data by device ("ouvrage") (metadata and annual withdrawal volumes) -} -\examples{ -getOuvrageSeries("OPR0000200109") -} diff --git a/man/getTimeSeries.Rd b/man/getTimeSeries.Rd deleted file mode 100644 index eab579d43c8334f098e70d88711a2731c75d0558..0000000000000000000000000000000000000000 --- a/man/getTimeSeries.Rd +++ /dev/null @@ -1,63 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/getTimeSeries.R -\name{getTimeSeriesCom} -\alias{getTimeSeriesCom} -\alias{getTimeSeriesDep} -\title{Get withdrawal time series for a geographical entity} -\usage{ -getTimeSeriesCom( - insee_com, - code_usage = NULL, - code_type_eau = NULL, - cfg = config::get(file = system.file("config.yml", package = "bnpe")), - cookie = getCookie(cfg) -) - -getTimeSeriesDep( - insee_dep, - code_usage = NULL, - code_type_eau = NULL, - cfg = config::get(file = system.file("config.yml", package = "bnpe")), - cookie = getCookie(cfg) -) -} -\arguments{ -\item{insee_com}{a \link{character} of length 5 representing the INSEE code of the commune} - -\item{code_usage}{a \code{\link[=character]{character()}} representing the withdrawal destination which can take the following values: -- "ENE" for energy -- "CAN" for artificial canals -- "BAR" for turbined water (dam) -- "AEP" for drinking water -- "IND" for industry -- "IRR" for irrigation} - -\item{code_type_eau}{a \code{\link[=character]{character()}} representing the withdrawal source which can take the following values: -- "CONT" for continental surface -- "SOUT" for subsurface -- "LIT" for littoral} - -\item{cfg}{a \link{config} object Configuration of the communication. Use by default the internal package -configuration stored at location \code{system.file("config.yml", package = "bnpe")}} - -\item{cookie}{a named \link{character} \link{vector} with the values of the cookies (See \link{getCookie})} - -\item{insee_dep}{a \link{character} of length 2 representing the INSEE code of the commune} -} -\value{ -a \link{data.frame} with one year by row and the following columns: -- "volume" the withdrawal annual volume in cubic meters -- "annee" the year -- "peuplement" a unknown code -} -\description{ -Get withdrawal time series for a geographical entity -} -\examples{ -# Withdrawal time series for Ardennes department -getTimeSeriesDep("08") - -# Withdrawal time series for the commune of Charleville-Mézières -getTimeSeriesCom("08105") - -} diff --git a/man/get_chronique.Rd b/man/get_prelevements_chronique.Rd similarity index 71% rename from man/get_chronique.Rd rename to man/get_prelevements_chronique.Rd index b63c22cd40d397ad77890ee7d18a95c41d2e7ccb..588ffeb868818c57eccd755332f6a7e19a8eaab9 100644 --- a/man/get_chronique.Rd +++ b/man/get_prelevements_chronique.Rd @@ -1,28 +1,28 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/get_chronique.R -\name{get_chronique} -\alias{get_chronique} +% Please edit documentation in R/get_prelevements_chronique.R +\name{get_prelevements_chronique} +\alias{get_prelevements_chronique} \title{Retrieve time series of withdrawals from Hub'Eau API} \usage{ -get_chronique( +get_prelevements_chronique( params, - cfg = config::get(file = system.file("config.yml", package = "bnpe")) + cfg = config::get(file = system.file("config.yml", package = "hubeau")) ) } \arguments{ \item{params}{\link{list} where the keys are the names of the filtered parameters and the values are the values of the filters. See the API documentation for the complete list of available filter parameters} \item{cfg}{a \link{config} object Configuration of the communication. Use by default the internal package -configuration stored at location \code{system.file("config.yml", package = "bnpe")}} +configuration} } \value{ a \link[tibble:tibble]{tibble::tibble} with all available parameters in columns and one row by device, year and usage. } \description{ -See the API documentation for available filter parameters: \url{https://hubeau.eaufrance.fr/page/api-prelevements-eau} +See the API documentation for available filter parameters: \url{https://hubeau.eaufrance.fr/page/api-prelevements-eau#/prelevements/chronique} } \examples{ # For retrieving the withdrawal time series of the devices located in Romilly-sur-Seine -get_chronique(list(code_commune_insee = "10323")) +get_prelevements_chronique(list(code_commune_insee = "10323")) } diff --git a/man/get_points_prelevement.Rd b/man/get_prelevements_prelevement.Rd similarity index 69% rename from man/get_points_prelevement.Rd rename to man/get_prelevements_prelevement.Rd index 1f2eec6643931dfaf0d2d17cb572df83dd4ad61b..63f6390171b938c225acc42c07a24250f6957337 100644 --- a/man/get_points_prelevement.Rd +++ b/man/get_prelevements_prelevement.Rd @@ -1,28 +1,28 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/get_points_prelevement.R -\name{get_points_prelevement} -\alias{get_points_prelevement} +% Please edit documentation in R/get_prelevements_prelevement.R +\name{get_prelevements_prelevement} +\alias{get_prelevements_prelevement} \title{Retrieve withdrawal points from Hub'Eau API} \usage{ -get_points_prelevement( +get_prelevements_prelevement( params, - cfg = config::get(file = system.file("config.yml", package = "bnpe")) + cfg = config::get(file = system.file("config.yml", package = "hubeau")) ) } \arguments{ \item{params}{\link{list} where the keys are the names of the filtered parameters and the values are the values of the filters. See the API documentation for the complete list of available filter parameters} \item{cfg}{a \link{config} object Configuration of the communication. Use by default the internal package -configuration stored at location \code{system.file("config.yml", package = "bnpe")}} +configuration} } \value{ a \link[tibble:tibble]{tibble::tibble} with all available parameters in columns and one row by device. } \description{ -See the API documentation for available filter parameters: \url{https://hubeau.eaufrance.fr/page/api-prelevements-eau} +See the API documentation for available filter parameters: \url{https://hubeau.eaufrance.fr/page/api-prelevements-eau#/prelevements/prelevement} } \examples{ # For retrieving the withdrawal points located in Romilly-sur-Seine -get_points_prelevement(list(code_commune_insee = "10323")) +get_prelevements_prelevement(list(code_commune_insee = "10323")) } diff --git a/pkgdown/favicon/apple-touch-icon-120x120.png b/pkgdown/favicon/apple-touch-icon-120x120.png new file mode 100644 index 0000000000000000000000000000000000000000..70a6700a5e790bac155c17e95f1db215712adf06 Binary files /dev/null and b/pkgdown/favicon/apple-touch-icon-120x120.png differ diff --git a/pkgdown/favicon/apple-touch-icon-152x152.png b/pkgdown/favicon/apple-touch-icon-152x152.png new file mode 100644 index 0000000000000000000000000000000000000000..ceeeb17018697bb11f5f7cab6135600a28dffbdd Binary files /dev/null and b/pkgdown/favicon/apple-touch-icon-152x152.png differ diff --git a/pkgdown/favicon/apple-touch-icon-180x180.png b/pkgdown/favicon/apple-touch-icon-180x180.png new file mode 100644 index 0000000000000000000000000000000000000000..341151e06916c2e7c139e369b8f420d8a496f40d Binary files /dev/null and b/pkgdown/favicon/apple-touch-icon-180x180.png differ diff --git a/pkgdown/favicon/apple-touch-icon-60x60.png b/pkgdown/favicon/apple-touch-icon-60x60.png new file mode 100644 index 0000000000000000000000000000000000000000..7969d5bd64205e1bdb782a9a7390afc9a3b4a9a4 Binary files /dev/null and b/pkgdown/favicon/apple-touch-icon-60x60.png differ diff --git a/pkgdown/favicon/apple-touch-icon-76x76.png b/pkgdown/favicon/apple-touch-icon-76x76.png new file mode 100644 index 0000000000000000000000000000000000000000..a6dbbdc09eb487f26c145afd6e95d9596ebb8ba4 Binary files /dev/null and b/pkgdown/favicon/apple-touch-icon-76x76.png differ diff --git a/pkgdown/favicon/apple-touch-icon.png b/pkgdown/favicon/apple-touch-icon.png new file mode 100644 index 0000000000000000000000000000000000000000..89bba155da2220adb3c8fdb9021f70a430a1df98 Binary files /dev/null and b/pkgdown/favicon/apple-touch-icon.png differ diff --git a/pkgdown/favicon/favicon-16x16.png b/pkgdown/favicon/favicon-16x16.png new file mode 100644 index 0000000000000000000000000000000000000000..80efbdd726a17dbf39da4b5e51538fb87d29a146 Binary files /dev/null and b/pkgdown/favicon/favicon-16x16.png differ diff --git a/pkgdown/favicon/favicon-32x32.png b/pkgdown/favicon/favicon-32x32.png new file mode 100644 index 0000000000000000000000000000000000000000..37026246c8504b083ff38b3966e5425e9cfac14b Binary files /dev/null and b/pkgdown/favicon/favicon-32x32.png differ diff --git a/pkgdown/favicon/favicon.ico b/pkgdown/favicon/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..7a57d3eb7f3f154f698bb904ea2d1aaf495d3174 Binary files /dev/null and b/pkgdown/favicon/favicon.ico differ