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-25 02:00:00, 2025-06-25 03:00:00, 2025-06-25 04: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.3, 5.8, 4.3, 2.4, 2.8, 2.7, 4.7, 6.4, 6.5, 6.6, 7.5, 5.8, 
#> $ vv        <dbl> 2.3, 2.3, 2.3, 1.1, 1.5, 1.2, 2.8, 4.2, 4.2, 2.8, 2.5, 1.9, 
#> $ dv        <dbl> 271, 255, 246, 166, 70, 67, 103, 107, 100, 359, 329, 277, 61…
#> $ lat       <dbl> 41.66056, 41.66056, 41.66056, 41.66056, 41.66056, 41.66056, 
#> $ dmax      <dbl> 300, 293, 273, 243, 65, 68, 125, 110, 113, 103, 315, 320, 83…
#> $ ubi       <chr> "ZARAGOZA  AEROPUERTO", "ZARAGOZA  AEROPUERTO", "ZARAGOZA  A…
#> $ pres      <dbl> 984.2, 984.5, 984.8, 984.5, 984.9, 985.0, 984.8, 984.4, 984.…
#> $ hr        <dbl> 62, 64, 64, 68, 70, 59, 46, 35, 27, 21, 21, 18, 17, 79, 80, 
#> $ stdvv     <dbl> 0.7, 0.4, 0.3, 0.2, 0.4, 0.4, 0.8, 0.8, 0.8, 0.9, 1.1, 0.7, 
#> $ ts        <dbl> 22.5, 22.0, 21.6, 20.1, 22.9, 27.3, 31.8, 34.1, 37.6, 41.0, 
#> $ pres_nmar <dbl> 1013.1, 1013.4, 1013.8, 1013.5, 1013.8, 1013.7, 1013.2, 1012…
#> $ tamin     <dbl> 22.7, 22.1, 21.8, 20.9, 21.2, 22.0, 24.2, 27.4, 30.2, 32.2, 
#> $ ta        <dbl> 22.7, 22.1, 21.8, 21.2, 22.0, 24.2, 27.4, 30.2, 32.2, 34.1, 
#> $ tamax     <dbl> 23.8, 22.9, 22.2, 21.8, 22.0, 24.2, 27.4, 30.2, 32.3, 34.3, 
#> $ tpr       <dbl> 15.1, 15.0, 14.7, 15.1, 16.3, 15.7, 14.7, 13.1, 10.9, 8.7, 8…
#> $ stddv     <dbl> 10, 8, 8, 19, 20, 35, 19, 14, 14, 25, 34, 29, 42, NA, NA, NA
#> $ inso      <dbl> 0.0, 0.0, 0.0, 0.0, 32.7, 60.0, 60.0, 60.0, 60.0, 60.0, 60.0…
#> $ tss5cm    <dbl> 33.0, 32.3, 31.6, 31.0, 30.5, 30.5, 31.2, 32.2, 33.7, 35.9, 
#> $ pacutp    <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NA, NA, NA, NA, NA, N
#> $ tss20cm   <dbl> 34.8, 34.5, 34.2, 33.8, 33.5, 33.1, 32.8, 32.6, 32.5, 32.5, 
#> $ rviento   <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 44, 49,