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> 2025-12-17 01:00:00, 2025-12-17 02:00:00, 2025-12-17 03: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> 5.9, 5.1, 4.9, 3.5, 4.3, 3.7, 4.2, 4.2, 4.3, 5.7, 4.7, 3.9, 
#> $ vv        <dbl> 4.0, 3.2, 2.9, 2.7, 2.9, 2.5, 2.8, 2.6, 2.7, 3.3, 2.8, 2.3, 
#> $ dv        <dbl> 296, 290, 297, 286, 303, 301, 278, 283, 295, 314, 297, 309, 
#> $ lat       <dbl> 41.66056, 41.66056, 41.66056, 41.66056, 41.66056, 41.66056, 
#> $ dmax      <dbl> 298, 305, 293, 298, 295, 305, 288, 293, 318, 315, 303, 283, 
#> $ ubi       <chr> "ZARAGOZA  AEROPUERTO", "ZARAGOZA  AEROPUERTO", "ZARAGOZA  A…
#> $ pres      <dbl> 987.5, 988.1, 988.6, 989.0, 989.6, 990.2, 991.1, 992.1, 992.…
#> $ hr        <dbl> 94, 94, 92, 94, 92, 94, 94, 95, 92, 86, 84, 76, NA, NA, NA, 
#> $ stdvv     <dbl> 0.4, 0.4, 0.4, 0.2, 0.3, 0.3, 0.3, 0.2, 0.4, 0.7, 0.4, 0.5, 
#> $ ts        <dbl> 10.0, 9.6, 9.9, 9.7, 9.8, 8.9, 9.0, 9.1, 10.2, 11.5, NA, NA,
#> $ pres_nmar <dbl> 1017.8, 1018.5, 1019.0, 1019.4, 1020.0, 1020.7, 1021.7, 1022…
#> $ tamin     <dbl> 10.2, 10.0, 10.0, 9.9, 9.8, 9.5, 9.3, 9.3, 9.4, 10.1, 11.2, 
#> $ ta        <dbl> 10.3, 10.0, 10.2, 9.9, 10.1, 9.5, 9.3, 9.4, 10.1, 11.2, 11.8…
#> $ tamax     <dbl> 10.4, 10.3, 10.2, 10.3, 10.1, 10.1, 9.5, 9.4, 10.1, 11.2, 11…
#> $ tpr       <dbl> 9.4, 9.0, 8.9, 8.9, 8.9, 8.5, 8.4, 8.7, 8.9, 8.9, NA, NA, NA
#> $ stddv     <dbl> 5, 6, 7, 5, 7, 6, 7, 5, 8, 12, 13, 13, NA, NA, NA, NA, NA, N
#> $ inso      <dbl> 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 4.8, 0.0, 17.0,
#> $ tss5cm    <dbl> 10.2, 10.2, 10.1, 10.0, 10.0, 9.9, 9.6, 9.5, 9.6, 10.0, 10.4…
#> $ pacutp    <dbl> 0.13, 0.02, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 
#> $ tss20cm   <dbl> 10.7, 10.7, 10.7, 10.6, 10.6, 10.6, 10.6, 10.5, 10.5, 10.4, 
#> $ rviento   <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 175, 129, 13…