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: 18
#> Columns: 25
#> $ 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> 2026-01-07 01:00:00, 2026-01-07 02:00:00, 2026-01-07 03:00:…
#> $ prec      <dbl> 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, 667, 667, 667, 
#> $ vmax      <dbl> 11.3, 9.0, 8.6, 7.2, 6.3, 6.3, 6.7, 7.6, 9.0, 1.9, 2.0, 1.8,
#> $ vv        <dbl> 6.0, 6.0, 3.7, 5.0, 4.1, 3.8, 5.5, 3.7, NA, 0.9, 0.8, 0.8, 0…
#> $ dv        <dbl> 287, 299, 269, 306, 288, 279, 272, 272, NA, 139, 141, 142, 1…
#> $ lat       <dbl> 41.66056, 41.66056, 41.66056, 41.66056, 41.66056, 41.66056, 
#> $ dmax      <dbl> 305, 300, 293, 305, 275, 280, 268, 265, 285, 122, 147, 158, 
#> $ ubi       <chr> "ZARAGOZA  AEROPUERTO", "ZARAGOZA  AEROPUERTO", "ZARAGOZA  A…
#> $ pres      <dbl> 989.4, 989.6, 989.6, 989.5, 989.1, 989.5, 989.5, 989.7, 990.…
#> $ hr        <dbl> 69, 66, 74, 65, 68, 67, 66, 66, 61, 69, 70, 73, 74, 78, 75, 
#> $ stdvv     <dbl> 0.4, 0.9, 0.4, 0.7, 0.5, 0.4, 0.5, 0.3, NA, NA, NA, NA, NA, 
#> $ tamin     <dbl> 0.7, 0.5, 0.1, -0.1, -0.3, 0.1, 0.1, 0.5, 0.9, -1.3, -1.6, -…
#> $ ta        <dbl> 0.7, 1.3, 0.1, 0.9, 0.3, 0.1, 0.5, 0.9, 2.7, -1.2, -1.4, -1.…
#> $ tamax     <dbl> 1.4, 1.3, 1.4, 0.9, 0.9, 0.7, 0.5, 0.9, 2.7, -1.0, -1.1, -1.…
#> $ stddv     <dbl> 4, 10, 15, 6, 5, 5, 5, 5, NA, NA, NA, NA, NA, NA, NA, NA, NA
#> $ inso      <dbl> 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 21.5, 21.8, NA, NA, NA, N
#> $ tss5cm    <dbl> 1.9, 1.7, 1.6, 1.5, 1.3, 1.2, 1.1, 1.1, NA, NA, NA, NA, NA, 
#> $ pacutp    <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, NA, NA, NA, NA, NA, NA, NA, NA, NA
#> $ tss20cm   <dbl> 4.1, 4.0, 3.9, 3.8, 3.7, 3.6, 3.5, 3.4, NA, NA, NA, NA, NA, 
#> $ pres_nmar <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, 1023.6, 1023.5, 1023.5, 
#> $ tpr       <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, -6.0, -6.0, -5.7, -5.4, 
#> $ rviento   <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, 32, 34, 32, 27, 37, 49,