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: 24
#> 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-04 01:00:00, 2026-02-04 02:00:00, 2026-02-04 03:00:…
#> $ prec      <dbl> 0.0, 0.0, 0.0, 0.4, 0.6, 0.8, 0.0, 0.2, 0.0, 0.0, 0.2, 0.0, 
#> $ alt       <dbl> 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 
#> $ vmax      <dbl> 5.2, 4.9, 5.2, 5.9, 6.5, 6.4, 5.8, 5.1, 5.2, 5.5, 7.2, 7.1, 
#> $ vv        <dbl> 2.9, 3.5, 3.0, 3.6, 4.9, 3.7, 3.8, 2.0, 4.0, 3.6, 5.0, 4.3, 
#> $ dv        <dbl> 121, 121, 105, 113, 111, 107, 115, 100, 119, 106, 122, 106, 
#> $ lat       <dbl> 41.66056, 41.66056, 41.66056, 41.66056, 41.66056, 41.66056, 
#> $ dmax      <dbl> 130, 113, 123, 123, 113, 125, 120, 103, 125, 100, 113, 113, 
#> $ ubi       <chr> "ZARAGOZA  AEROPUERTO", "ZARAGOZA  AEROPUERTO", "ZARAGOZA  A…
#> $ pres      <dbl> 967.1, 966.0, 965.0, 963.8, 963.5, 963.0, 962.9, 963.6, 963.…
#> $ hr        <dbl> 90, 88, 88, 89, 94, 96, 97, 97, 96, 93, 86, 84, 97, 98, 99, 
#> $ stdvv     <dbl> 0.4, 0.5, 0.6, 0.5, 0.7, 0.6, 0.6, 0.3, 0.4, 0.7, 0.7, 0.7, 
#> $ ts        <dbl> 4.4, 4.8, 4.9, 4.9, 4.7, 4.7, 4.8, 4.9, 6.0, 9.1, 10.5, 11.2…
#> $ pres_nmar <dbl> 997.5, 996.3, 995.2, 994.0, 993.7, 993.2, 993.1, 993.8, 993.…
#> $ tamin     <dbl> 4.2, 4.7, 4.9, 5.0, 4.8, 4.7, 4.7, 4.8, 4.9, 5.9, 7.4, 8.6, 
#> $ ta        <dbl> 4.7, 4.9, 5.1, 5.1, 4.8, 4.7, 4.8, 4.9, 5.9, 7.4, 8.6, 9.4, 
#> $ tamax     <dbl> 4.8, 4.9, 5.4, 5.2, 5.2, 4.8, 4.9, 4.9, 5.9, 7.4, 8.6, 9.4, 
#> $ tpr       <dbl> 3.2, 3.0, 3.2, 3.4, 3.9, 4.1, 4.3, 4.5, 5.3, 6.4, 6.4, 6.8, 
#> $ stddv     <dbl> 12, 6, 9, 7, 8, 9, 8, 14, 8, 10, 10, 16, NA, NA, NA, NA, NA,
#> $ inso      <dbl> 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 22.5, 58.9, 43.…
#> $ tss5cm    <dbl> 5.7, 5.6, 5.6, 5.7, 5.7, 5.7, 5.7, 5.7, 5.8, 6.1, 7.2, 8.4, 
#> $ pacutp    <dbl> 0.00, 0.00, 0.12, 0.23, 0.69, 0.61, 0.05, 0.25, 0.00, 0.03, 
#> $ tss20cm   <dbl> 7.6, 7.4, 7.3, 7.2, 7.1, 7.0, 7.0, 6.9, 6.9, 6.9, 6.9, 7.0, 
#> $ rviento   <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 73, 74, 64,