[go: nahoru, domu]

Available endpoints are:

  • get_hydrometrie_obs_elab retrieves hydrometric elaborate observations (daily/monthly mean flow)

  • get_hydrometrie_observations_tr retrieves hydrometric "real time" observations ()

  • get_hydrometrie_sites retrieves hydrometric sites

  • get_hydrometrie_stations retrieves hydrometric stations

See the API documentation of each endpoint for available filter parameters: https://hubeau.eaufrance.fr/page/api-hydrometrie

get_hydrometrie_obs_elab(...)

get_hydrometrie_observations_tr(..., entities = "station")

get_hydrometrie_sites(..., unique_site = TRUE)

get_hydrometrie_stations(..., code_sandre_reseau_station = FALSE)

Arguments

...

parameters of the queries and their values in the format Param1_Name = "Param1 value", Param2_Name = "Param2 value", use the function list_params for a list of the available filter parameters for a given API endpoint and see the API documentation for their description

entities

1-length 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

unique_site

optional logical, if set to FALSE sites with several different locations produce one row by different location otherwise the first location found is used for fields code_commune_site, libelle_commune, code_departement, code_region, libelle_region, libelle_departement

code_sandre_reseau_station

optional logical indicating if 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 tibble::tibble with one row by record and one column by field.

Examples

# \dontrun{
# Retrieve the hydrometric sites in the department of Aube
get_hydrometrie_sites(code_departement = "10")
#> Warning: The site 'H0203020' has 2 different locations, only the first one is returned
#> # A tibble: 27 × 39
#>    code_site libelle_site          type_site coordonnee_x_site coordonnee_y_site
#>    <chr>     <chr>                 <chr>                 <dbl>             <dbl>
#>  1 F3550001  La Vanne à Paisy-Cos… REEL                 752416           6793820
#>  2 H0100020  La Seine à Plaines-S… REEL                 810441           6767194
#>  3 H0203020  La Laignes aux Ricey… REEL                 801571           6763252
#>  4 H0210010  La Seine à Polisy     REEL                 802885           6774610
#>  5 H0321040  L'Ource à Celles-sur… REEL                 804893           6776215
#>  6 H0400010  La Seine à Bar-sur-S… REEL                 802511           6780502
#>  7 H0400020  La Seine à Courtenot  REEL                 798933           6783584
#>  8 H0413010  La Sarce à Virey-sou… REEL                 796857           6783149
#>  9 H0503010  L'Hozain à Buchères … REEL                 782364           6794544
#> 10 H0702010  La Barse à Montiéram… REEL                 795978           6793759
#> # ℹ 17 more rows
#> # ℹ 34 more variables: code_projection <int>, longitude_site <dbl>,
#> #   latitude_site <dbl>, altitude_site <dbl>, code_systeme_alti_site <int>,
#> #   surface_bv <dbl>, statut_site <int>, premier_mois_etiage_site <int>,
#> #   premier_mois_annee_hydro_site <int>, influence_generale_site <int>,
#> #   code_entite_hydro_site <chr>, code_troncon_hydro_site <chr>,
#> #   code_commune_site <chr>, code_zone_hydro_site <chr>, …

# The same operation returning 2 rows for the site 'H0203020' which has 2 different locations
get_hydrometrie_sites(code_departement = "10", unique_site = FALSE)
#> # A tibble: 28 × 39
#>    code_site libelle_site          type_site coordonnee_x_site coordonnee_y_site
#>    <chr>     <chr>                 <chr>                 <dbl>             <dbl>
#>  1 F3550001  La Vanne à Paisy-Cos… REEL                 752416           6793820
#>  2 H0100020  La Seine à Plaines-S… REEL                 810441           6767194
#>  3 H0203020  La Laignes aux Ricey… REEL                 801571           6763252
#>  4 H0203020  La Laignes aux Ricey… REEL                 801571           6763252
#>  5 H0210010  La Seine à Polisy     REEL                 802885           6774610
#>  6 H0321040  L'Ource à Celles-sur… REEL                 804893           6776215
#>  7 H0400010  La Seine à Bar-sur-S… REEL                 802511           6780502
#>  8 H0400020  La Seine à Courtenot  REEL                 798933           6783584
#>  9 H0413010  La Sarce à Virey-sou… REEL                 796857           6783149
#> 10 H0503010  L'Hozain à Buchères … REEL                 782364           6794544
#> # ℹ 18 more rows
#> # ℹ 34 more variables: code_projection <int>, longitude_site <dbl>,
#> #   latitude_site <dbl>, altitude_site <dbl>, code_systeme_alti_site <int>,
#> #   surface_bv <dbl>, statut_site <int>, premier_mois_etiage_site <int>,
#> #   premier_mois_annee_hydro_site <int>, influence_generale_site <int>,
#> #   code_entite_hydro_site <chr>, code_troncon_hydro_site <chr>,
#> #   code_commune_site <chr>, code_zone_hydro_site <chr>, …

# Retrieve the hydrometric stations in the department of Aube
get_hydrometrie_stations(code_departement = "10")
#> # A tibble: 33 × 42
#>    code_site libelle_site              code_station libelle_station type_station
#>    <chr>     <chr>                     <chr>        <chr>           <chr>       
#>  1 F1280001  La Voire à Bétignicourt   F128000101   La Voire à Bét… DEB         
#>  2 F2110001  La Seine au Mériot        F211000101   La Seine au Mé… LIMNI       
#>  3 F2110001  La Seine au Mériot        F211000102   La Seine au Mé… LIMNI       
#>  4 F3550001  La Vanne à Paisy-Cosdon   F355000101   La Vanne à Pai… LIMNI       
#>  5 H0100020  La Seine à Plaines-Saint… H010002001   La Seine à Pla… LIMNI       
#>  6 H0203020  La Laignes aux Riceys et… H020302002   La Laignes aux… LIMNI       
#>  7 H0210010  La Seine à Polisy         H021001001   La Seine à Pol… LIMNI       
#>  8 H0321040  L'Ource à Celles-sur-Our… H032104001   L'Ource à Cell… LIMNI       
#>  9 H0400010  La Seine à Bar-sur-Seine  H040001001   La Seine à Bar… LIMNI       
#> 10 H0400020  La Seine à Courtenot      H040002001   La Seine à Cou… LIMNI       
#> # ℹ 23 more rows
#> # ℹ 37 more variables: coordonnee_x_station <dbl>, coordonnee_y_station <dbl>,
#> #   code_projection <int>, longitude_station <dbl>, latitude_station <dbl>,
#> #   influence_locale_station <int>, commentaire_station <chr>,
#> #   altitude_ref_alti_station <dbl>, code_systeme_alti_site <int>,
#> #   code_commune_station <chr>, libelle_commune <chr>, code_departement <chr>,
#> #   code_region <chr>, libelle_region <chr>, code_cours_eau <chr>, …

# Which parameters are available for endpoint "obs_elab" of API "hydrometrie"?
list_params("hydrometrie", "obs_elab")
#>  [1] "bbox"                "code_entite"         "cursor"             
#>  [4] "date_debut_obs_elab" "date_fin_obs_elab"   "distance"           
#>  [7] "fields"              "grandeur_hydro_elab" "latitude"           
#> [10] "longitude"           "resultat_max"        "resultat_min"       
#> [13] "size"               

# Retrieve the hydrometric monthly mean flow at site 'H0203020'
get_hydrometrie_obs_elab(code_entite = "H0203020", grandeur_hydro_elab = "QmM")
#> # A tibble: 671 × 14
#>    code_site code_station date_obs_elab resultat_obs_elab date_prod  code_statut
#>    <chr>     <chr>        <chr>                     <dbl> <chr>            <int>
#>  1 H0203020  H020302001   1968-02-01                 6246 2021-09-1…          16
#>  2 H0203020  H020302001   1968-03-01                 3578 2021-09-1…          16
#>  3 H0203020  H020302001   1968-04-01                 1993 2021-09-1…          16
#>  4 H0203020  H020302001   1968-05-01                 4934 2021-09-1…          16
#>  5 H0203020  H020302001   1968-06-01                 1610 2021-09-1…          16
#>  6 H0203020  H020302001   1968-07-01                 1022 2021-09-1…          16
#>  7 H0203020  H020302001   1968-08-01                 1040 2021-09-1…          16
#>  8 H0203020  H020302001   1968-09-01                 3451 2021-09-1…          16
#>  9 H0203020  H020302001   1968-10-01                 4242 2021-09-1…          16
#> 10 H0203020  H020302001   1968-11-01                 2675 2021-09-1…          16
#> # ℹ 661 more rows
#> # ℹ 8 more variables: libelle_statut <chr>, code_methode <int>,
#> #   libelle_methode <chr>, code_qualification <int>,
#> #   libelle_qualification <chr>, longitude <dbl>, latitude <dbl>,
#> #   grandeur_hydro_elab <chr>

# Retrieve the hydrometric daily mean flow at site 'H0203020' of the last 30 days
get_hydrometrie_obs_elab(code_entite = "H0203020",
                         date_debut_obs_elab = format(Sys.Date() -30, "%Y-%m-%d"),
                         grandeur_hydro_elab = "QmJ")
#> # A tibble: 23 × 14
#>    code_site code_station date_obs_elab resultat_obs_elab date_prod  code_statut
#>    <chr>     <chr>        <chr>                     <dbl> <chr>            <int>
#>  1 H0203020  H020302002   2024-02-03                 4606 2024-02-0…           4
#>  2 H0203020  H020302002   2024-02-04                 4340 2024-02-0…           4
#>  3 H0203020  H020302002   2024-02-05                 4094 2024-02-0…           4
#>  4 H0203020  H020302002   2024-02-06                 3842 2024-02-0…           4
#>  5 H0203020  H020302002   2024-02-07                 3726 2024-02-0…           4
#>  6 H0203020  H020302002   2024-02-08                 4102 2024-02-0…           4
#>  7 H0203020  H020302002   2024-02-09                 4251 2024-02-1…           4
#>  8 H0203020  H020302002   2024-02-10                 5008 2024-02-1…           4
#>  9 H0203020  H020302002   2024-02-11                 7130 2024-02-1…           4
#> 10 H0203020  H020302002   2024-02-12                 8692 2024-02-1…           4
#> # ℹ 13 more rows
#> # ℹ 8 more variables: libelle_statut <chr>, code_methode <int>,
#> #   libelle_methode <chr>, code_qualification <int>,
#> #   libelle_qualification <chr>, longitude <dbl>, latitude <dbl>,
#> #   grandeur_hydro_elab <chr>
# }