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: 26
#> 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-06-16 22:00:00, 2025-06-16 23:00:00, 2025-06-17 00: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> 3.8, 6.6, 6.9, 4.9, 7.4, 7.9, 7.1, 7.6, 6.4, 8.6, 8.9, 9.4, 
#> $ vv        <dbl> 2.5, 4.7, 3.0, 2.9, 3.3, 6.0, 4.8, 3.9, 5.1, 6.4, 6.3, 7.3, 
#> $ dv        <dbl> 309, 293, 319, 305, 301, 298, 274, 288, 297, 302, 306, 309, 
#> $ lat       <dbl> 41.66056, 41.66056, 41.66056, 41.66056, 41.66056, 41.66056, 
#> $ dmax      <dbl> 313, 280, 295, 310, 303, 288, 300, 285, 293, 283, 315, 295, 
#> $ ubi       <chr> "ZARAGOZA  AEROPUERTO", "ZARAGOZA  AEROPUERTO", "ZARAGOZA  A…
#> $ pres      <dbl> 990.3, 990.6, 990.9, 991.1, 990.7, 990.5, 990.5, 990.6, 990.…
#> $ hr        <dbl> 51, 58, 63, 67, 68, 68, 71, 75, 73, 67, 61, 56, 53, 37, 42, 
#> $ stdvv     <dbl> 0.5, 0.8, 0.5, 0.7, 0.4, 0.7, 0.5, 0.5, 0.6, 0.9, 1.1, 0.8, 
#> $ ts        <dbl> 26.3, 26.4, 25.1, 24.1, 23.4, 23.4, 22.6, 21.9, 23.7, 26.4, 
#> $ pres_nmar <dbl> 1018.8, 1019.2, 1019.7, 1020.0, 1019.6, 1019.5, 1019.6, 1019…
#> $ tamin     <dbl> 27.4, 26.6, 25.4, 24.2, 23.6, 23.2, 22.3, 21.5, 21.5, 22.2, 
#> $ ta        <dbl> 27.7, 26.6, 25.4, 24.2, 23.7, 23.3, 22.3, 21.5, 22.3, 23.5, 
#> $ tamax     <dbl> 28.3, 27.7, 26.6, 25.4, 24.5, 23.7, 23.3, 22.3, 22.3, 23.5, 
#> $ tpr       <dbl> 16.6, 17.7, 17.9, 17.7, 17.5, 17.1, 16.8, 16.9, 17.2, 17.1, 
#> $ stddv     <dbl> 13, 13, 11, 16, 10, 5, 7, 8, 8, 9, 11, 7, 8, NA, NA, NA, NA,
#> $ inso      <dbl> 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 40.1, 60.0, 60.0, 60…
#> $ tss5cm    <dbl> 31.7, 31.0, 30.4, 29.8, 29.3, 28.8, 28.3, 27.8, 27.6, 27.5, 
#> $ pacutp    <dbl> 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 
#> $ tss20cm   <dbl> 31.3, 31.2, 31.0, 30.8, 30.5, 30.3, 30.0, 29.8, 29.5, 29.3, 
#> $ rviento   <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 126, 96,