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-05-21 00:00:00, 2025-05-21 01:00:00, 2025-05-21 02: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> 11.8, 9.7, 8.3, 10.9, 9.6, 9.9, 9.1, 10.7, 11.1, 10.2, 9.1, 
#> $ vv        <dbl> 6.7, 6.9, 6.3, 8.0, 7.4, 6.1, 5.4, 8.2, 7.4, 5.4, 6.1, 5.2, 
#> $ dv        <dbl> 279, 283, 292, 299, 288, 285, 288, 296, 303, 310, 309, 312, 
#> $ lat       <dbl> 41.66056, 41.66056, 41.66056, 41.66056, 41.66056, 41.66056, 
#> $ dmax      <dbl> 300, 290, 290, 298, 308, 293, 290, 288, 303, 315, 320, 318, 
#> $ ubi       <chr> "ZARAGOZA  AEROPUERTO", "ZARAGOZA  AEROPUERTO", "ZARAGOZA  A…
#> $ pres      <dbl> 991.5, 991.3, 991.2, 990.7, 990.7, 990.8, 991.2, 991.4, 991.…
#> $ hr        <dbl> 64, 68, 70, 71, 73, 76, 71, 65, 61, 61, 53, 43, 34, 52, 60, 
#> $ stdvv     <dbl> 0.8, 0.9, 0.7, 0.9, 0.8, 0.8, 0.7, 1.0, 1.3, 1.0, 1.1, 1.0, 
#> $ ts        <dbl> 14.5, 13.9, 13.6, 13.5, 12.5, 12.3, 14.0, 17.5, 20.2, 23.5, 
#> $ pres_nmar <dbl> 1021.4, 1021.3, 1021.2, 1020.7, 1020.8, 1020.9, 1021.2, NA, 
#> $ tamin     <dbl> 15.1, 14.7, 14.1, 13.9, 13.4, 12.9, 13.0, 14.4, 15.5, 16.2, 
#> $ ta        <dbl> 15.1, 14.7, 14.3, 13.9, 13.4, 13.0, 14.4, 15.6, 16.4, 17.5, 
#> $ tamax     <dbl> 16.3, 15.1, 14.7, 14.4, 13.9, 13.4, 14.4, 15.6, 16.4, 17.5, 
#> $ tpr       <dbl> 8.4, 8.9, 8.9, 8.8, 8.7, 8.9, 9.2, NA, NA, 9.9, 9.8, 8.5, 6.…
#> $ stddv     <dbl> 6, 7, 6, 5, 6, 6, 8, 7, 9, 11, 13, 16, 12, NA, NA, NA, NA, N
#> $ inso      <dbl> 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 31.6, 60.0, 60.0, 60.0, 60.0, 
#> $ tss5cm    <dbl> 20.8, 20.2, 19.8, 19.4, 19.0, 18.6, 18.4, 18.5, 18.9, 19.8, 
#> $ pacutp    <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NA, NA, NA, NA, NA, N
#> $ tss20cm   <dbl> 22.8, 22.6, 22.3, 22.1, 21.8, 21.6, 21.4, 21.1, 20.9, 20.7, 
#> $ rviento   <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 90, 106,