An error occurred while loading the file. Please try again.
-
Dorchies David authored
Closes #16
bd7ab768
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/get_hydrometrie.R
\name{get_hydrometrie_obs_elab}
\alias{get_hydrometrie_obs_elab}
\alias{get_hydrometrie_observations_tr}
\alias{get_hydrometrie_sites}
\alias{get_hydrometrie_stations}
\title{Retrieve data from API "Hydrométrie"}
\usage{
get_hydrometrie_obs_elab(
params,
cfg = config::get(file = system.file("config.yml", package = "hubeau"))
)
get_hydrometrie_observations_tr(
params,
entities = "station",
cfg = config::get(file = system.file("config.yml", package = "hubeau"))
)
get_hydrometrie_sites(
params,
unique_site = TRUE,
cfg = config::get(file = system.file("config.yml", package = "hubeau"))
)
get_hydrometrie_stations(
params,
code_sandre_reseau_station = FALSE,
cfg = config::get(file = system.file("config.yml", package = "hubeau"))
)
}
\arguments{
\item{params}{a \link{list} the list of parameters of the queries and their values in the format \code{list(ParamName = "Param value", ...)}, use the function \link{get_available_params} for a list of the available filter parameters for a given operation in an API and see the API documentation for their description}
\item{cfg}{a \link{config} object describing the configuration of the APIs. Use the internal package configuration by default
configuration}
\item{entities}{1-length \link{character} string filtering the rows of the returned value, possible values are: "station" for filtering on station rows, "site" for filtering on site rows, "both" for keeping all the rows}
\item{unique_site}{optional \link{logical}, if set to \code{FALSE} sites with several different locations produce one row by different location otherwise the first location found is used for fields \code{code_commune_site}, \code{libelle_commune}, \code{code_departement}, \code{code_region}, \code{libelle_region}, \code{libelle_departement}}
\item{code_sandre_reseau_station}{optional \link{logical} indicating if \code{code_sandre_reseau_station} field is included in the result; if so, one line is added by item and other fields are repeated}
}
\value{
a \link[tibble:tibble]{tibble::tibble} with all available parameters in columns.
}
\description{
Available endpoints are:
\itemize{
\item \code{get_hydrometrie_obs_elab} retrieves hydrometric elaborate observations (daily/monthly mean flow)
\item \code{get_hydrometrie_observations_tr} retrieves hydrometric "real time" observations ()
\item \code{get_hydrometrie_sites} retrieves hydrometric sites
\item \code{get_hydrometrie_stations} retrieves hydrometric stations
}
See the API documentation of each endpoint for available filter parameters:
\url{https://hubeau.eaufrance.fr/page/api-hydrometrie}
}
\examples{
# Retrieve the hydrometric sites in the department of Aube
get_hydrometrie_sites(list(code_departement = "10"))
# The same operation returning 2 rows for the site 'H0203020' which has 2 different locations
get_hydrometrie_sites(list(code_departement = "10"), unique_site = FALSE)
\dontrun{
# This function is currently (2021-12-23) unstable and can be unavailable
# (See https://github.com/BRGM/hubeau/issues/85)
# Retrieve the hydrometric stations in the department of Aube
7172737475767778798081828384858687888990
get_hydrometrie_stations(list(code_departement = "10"))
}
# Which parameters are available for endpoint "obs_elab" of API "hydrometrie"?
get_available_params("hydrometrie", "obs_elab")
# Retrieve the hydrometric monthly mean flow at site 'H0203020'
get_hydrometrie_obs_elab(list(code_entite = "H0203020", grandeur_hydro_elab = "QmM"))
# Retrieve the hydrometric daily mean flow at site 'H0203020' of the last 30 days
get_hydrometrie_obs_elab(
list(code_entite = "H0203020",
date_debut_obs_elab = format(Sys.Date() -30, "\%Y-\%m-\%d"),
grandeur_hydro_elab = "QmJ"))
}
\seealso{
\link{doApiQuery} for more details on the API querying process.
}