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-25 22:00:00, 2025-05-25 23:00:00, 2025-05-26 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> 10.9, 11.8, 10.3, 11.7, 12.7, 10.5, 10.9, 10.2, 8.1, 11.2, 1…
#> $ vv        <dbl> 7.1, 6.4, 8.3, 8.1, 7.7, 8.2, 8.1, 6.8, 5.5, 6.4, 8.0, 5.7, 
#> $ dv        <dbl> 312, 307, 296, 290, 294, 290, 295, 289, 290, 312, 302, 314, 
#> $ lat       <dbl> 41.66056, 41.66056, 41.66056, 41.66056, 41.66056, 41.66056, 
#> $ dmax      <dbl> 315, 310, 298, 300, 300, 298, 293, 295, 295, 328, 315, 298, 
#> $ ubi       <chr> "ZARAGOZA  AEROPUERTO", "ZARAGOZA  AEROPUERTO", "ZARAGOZA  A…
#> $ pres      <dbl> 991.6, 991.8, 991.6, 991.5, 991.6, 991.3, 991.3, 991.8, 992.…
#> $ hr        <dbl> 50, 55, 60, 63, 66, 71, 72, 76, 71, 67, 63, 58, 53, 54, 43, 
#> $ stdvv     <dbl> 1.1, 0.9, 0.9, 1.0, 1.1, 0.9, 0.8, 0.6, 0.9, 1.1, 1.2, 1.1, 
#> $ ts        <dbl> 20.7, 18.9, 18.0, 17.3, 16.6, 16.0, 15.6, 15.1, 16.5, 19.6, 
#> $ pres_nmar <dbl> 1021.0, 1021.4, 1021.3, 1021.2, 1021.4, 1021.2, 1021.2, 1021…
#> $ tamin     <dbl> 20.1, 18.5, 17.5, 16.9, 16.2, 15.6, 15.3, 14.7, 14.7, 15.9, 
#> $ ta        <dbl> 20.1, 18.5, 17.5, 16.9, 16.2, 15.6, 15.3, 14.8, 16.0, 17.3, 
#> $ tamax     <dbl> 22.0, 20.1, 18.5, 17.5, 16.9, 16.2, 15.7, 15.3, 16.0, 17.3, 
#> $ tpr       <dbl> 9.3, 9.3, 9.7, 9.8, 9.8, 10.4, 10.3, 10.6, 10.8, 11.1, 11.2,
#> $ stddv     <dbl> 8, 8, 5, 6, 6, 5, 5, 5, 11, 10, 10, 15, 12, NA, NA, NA, NA, 
#> $ inso      <dbl> 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 32.7, 60.0, 60.0, 60…
#> $ tss5cm    <dbl> 27.1, 26.3, 25.5, 24.9, 24.3, 23.7, 23.3, 22.8, 22.5, 22.5, 
#> $ pacutp    <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NA, NA, NA, NA, NA, N
#> $ tss20cm   <dbl> 26.7, 26.6, 26.4, 26.2, 25.9, 25.7, 25.4, 25.1, 24.9, 24.6, 
#> $ rviento   <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 64, 88,