Skip to contents

Get last observation values for a station.

Usage

aemet_last_obs(
  station = "all",
  verbose = FALSE,
  return_sf = FALSE,
  extract_metadata = FALSE,
  progress = TRUE
)

Arguments

station

Character string with station identifier code(s) (see aemet_stations()) or "all" for all the stations.

verbose

Logical TRUE/FALSE. Provides information about the flow of information between the client and server.

return_sf

Logical TRUE or FALSE. Should the function return an sf spatial object? If FALSE (the default value) it returns a tibble. Note that you need to have the sf package installed.

extract_metadata

Logical TRUE/FALSE. On TRUE the output is a tibble with the description of the fields. See also get_metadata_aemet().

progress

Logical, display a cli::cli_progress_bar() object. If verbose = TRUE won't be displayed.

Value

A tibble or a sf object

API Key

You need to set your API Key globally using aemet_api_key().

Examples


library(tibble)
obs <- aemet_last_obs(c("9434", "3195"))
glimpse(obs)
#> Rows: 24
#> Columns: 26
#> $ idema     <chr> "9434", "9434", "9434", "9434", "9434", "9434", "9434", "943…
#> $ lon       <dbl> -1.004167, -1.004167, -1.004167, -1.004167, -1.004167, -1.00…
#> $ fint      <dttm> 2024-06-23 09:00:00, 2024-06-23 10:00:00, 2024-06-23 11:00:…
#> $ prec      <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
#> $ alt       <dbl> 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, …
#> $ vmax      <dbl> 16.3, 18.2, 17.4, 17.0, 17.3, 17.7, 16.9, 18.3, 16.3, 18.9, …
#> $ vv        <dbl> 10.7, 11.6, 10.9, 11.1, 11.9, 12.4, 10.8, 11.1, 11.7, 12.9, …
#> $ dv        <dbl> 315, 316, 314, 311, 308, 309, 315, 317, 315, 314, 312, 304, …
#> $ lat       <dbl> 41.66056, 41.66056, 41.66056, 41.66056, 41.66056, 41.66056, …
#> $ dmax      <dbl> 310, 310, 313, 303, 295, 308, 308, 313, 318, 328, 310, 318, …
#> $ ubi       <chr> "ZARAGOZA  AEROPUERTO", "ZARAGOZA  AEROPUERTO", "ZARAGOZA  A…
#> $ pres      <dbl> 988.3, 987.8, 987.8, 987.2, 986.8, 986.1, 985.8, 985.3, 985.…
#> $ hr        <dbl> 57, 52, 48, 47, 46, 44, 44, 44, 46, 49, 52, 56, 47, 42, 40, …
#> $ stdvv     <dbl> 1.8, 2.0, 1.7, 1.7, 2.0, 1.8, 2.0, 2.0, 1.9, 1.8, 1.7, 1.6, …
#> $ ts        <dbl> 28.6, 30.5, 33.1, 34.5, 35.3, 35.4, 35.4, 33.0, 30.9, 28.5, …
#> $ pres_nmar <dbl> 1017.3, 1016.7, 1016.6, 1015.9, 1015.4, 1014.6, 1014.3, 1013…
#> $ tamin     <dbl> 21.0, 22.3, 23.7, 25.0, 25.4, 26.1, 26.8, 26.6, 26.0, 25.1, …
#> $ ta        <dbl> 22.3, 23.7, 25.0, 25.8, 26.3, 27.1, 27.1, 26.9, 26.1, 25.1, …
#> $ tamax     <dbl> 22.3, 23.8, 25.3, 26.0, 26.4, 27.1, 27.5, 27.3, 26.9, 26.4, …
#> $ tpr       <dbl> 13.4, 13.3, 13.3, 13.7, 13.8, 13.8, 13.8, 13.7, 13.6, 13.7, …
#> $ stddv     <dbl> 9, 10, 9, 9, 8, 9, 10, 9, 8, 8, 7, 6, NA, NA, NA, NA, NA, NA…
#> $ inso      <dbl> 60.0, 60.0, 60.0, 51.8, 51.2, 56.9, 58.9, 60.0, 58.9, 59.8, …
#> $ tss5cm    <dbl> 26.4, 28.0, 29.6, 31.3, 32.6, 33.9, 34.7, 34.9, 34.4, 33.4, …
#> $ pacutp    <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NA, NA, NA, NA, NA, NA, …
#> $ tss20cm   <dbl> 26.1, 26.1, 26.3, 26.6, 27.0, 27.6, 28.2, 28.8, 29.4, 29.8, …
#> $ rviento   <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 83, 104, 78,…