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: 22
#> 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> 2026-02-26 22:00:00, 2026-02-26 23:00:00, 2026-02-27 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.1, 3.7, 3.6, 3.3, 2.8, 3.4, 2.9, 2.5, 3.9, 3.8, 4.0, 4.3, 
#> $ vv        <dbl> 1.6, 2.9, 2.2, 1.5, 1.7, 2.0, 1.8, 1.9, 2.4, 1.5, 2.0, 3.2, 
#> $ dv        <dbl> 116, 115, 133, 130, 105, 131, 116, 121, 83, 130, 134, 116, 1…
#> $ lat       <dbl> 41.66056, 41.66056, 41.66056, 41.66056, 41.66056, 41.66056, 
#> $ dmax      <dbl> 110, 118, 138, 128, 93, 125, 133, 123, 80, 125, 135, 105, 12…
#> $ ubi       <chr> "ZARAGOZA  AEROPUERTO", "ZARAGOZA  AEROPUERTO", "ZARAGOZA  A…
#> $ pres      <dbl> 995.4, 995.4, 995.4, 995.1, 994.9, 994.6, 994.3, 994.1, 993.…
#> $ hr        <dbl> 81, 82, 81, 84, 87, 89, 91, 93, 95, 95, 92, 85, 37, 39, 42, 
#> $ stdvv     <dbl> 0.3, 0.3, 0.3, 0.3, 0.3, 0.4, 0.2, 0.2, 0.4, 0.3, 0.3, 0.4, 
#> $ ts        <dbl> 9.8, 9.6, 9.0, 8.1, 7.2, 7.3, 6.4, 5.9, 6.1, 5.7, 8.6, 11.2,
#> $ pres_nmar <dbl> 1025.9, 1026.0, 1026.0, 1025.8, 1025.7, 1025.4, 1025.1, 1025…
#> $ tamin     <dbl> 11.5, 10.6, 10.2, 9.4, 8.6, 8.0, 7.3, 6.9, 6.4, 6.3, 6.4, 7.…
#> $ ta        <dbl> 11.5, 10.6, 10.2, 9.4, 8.6, 8.1, 7.3, 6.9, 6.4, 6.4, 7.8, 9.…
#> $ tamax     <dbl> 12.2, 11.5, 10.9, 10.2, 9.4, 8.6, 8.1, 7.4, 6.9, 6.4, 7.8, 9…
#> $ tpr       <dbl> 8.4, 7.7, 7.1, 6.8, 6.5, 6.4, 5.9, 5.8, 5.6, 5.6, 6.5, 7.1, 
#> $ stddv     <dbl> 11, 6, 7, 7, 9, 8, 6, 6, 10, 10, 9, 8, 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, 0.5, 52.2, 60.0…
#> $ tss5cm    <dbl> 12.9, 12.4, 12.0, 11.6, 11.2, 10.8, 10.5, 10.1, 9.8, 9.6, 9.…
#> $ pacutp    <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NA, NA, NA, NA, NA, NA, 
#> $ tss20cm   <dbl> 13.3, 13.2, 13.1, 12.9, 12.7, 12.6, 12.4, 12.2, 12.0, 11.8, 
#> $ rviento   <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 42, 27, 59,