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"))
#> HTTP 429: Límite de peticiones o caudal por minuto excedido para este usuario. Espere al siguiente minuto. Retrying...
#> Waiting 3s for retry backoff ■■■■■■■■■■■■                    
#> Waiting 3s for retry backoff ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■  
#> Waiting 3s for retry backoff ■■■■■■■■■■■■■■■                 
#> Waiting 3s for retry backoff ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 
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-02-09 23:00:00, 2025-02-10 00:00:00, 2025-02-10 01: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> 1.7, 1.9, 2.1, 3.1, 2.9, 2.6, 3.9, 3.1, 2.6, 2.4, 2.1, 2.9, …
#> $ vv        <dbl> 1.1, 1.4, 1.7, 2.0, 1.6, 0.7, 0.4, 2.2, 1.2, 1.2, 1.0, 1.8, …
#> $ dv        <dbl> 142, 174, 124, 140, 147, 12, 138, 139, 177, 169, 92, 108, 11…
#> $ lat       <dbl> 41.66056, 41.66056, 41.66056, 41.66056, 41.66056, 41.66056, …
#> $ dmax      <dbl> 133, 175, 130, 125, 140, 130, 95, 143, 138, 175, 75, 90, 85,…
#> $ ubi       <chr> "ZARAGOZA  AEROPUERTO", "ZARAGOZA  AEROPUERTO", "ZARAGOZA  A…
#> $ pres      <dbl> 994.6, 994.6, 994.4, 994.1, 993.6, 993.3, 993.2, 992.8, 993.…
#> $ hr        <dbl> 86, 87, 85, 84, 86, 86, 88, 87, 88, 88, 85, 78, 71, 88, 89, …
#> $ stdvv     <dbl> 0.2, 0.2, 0.2, 0.2, 0.3, 0.3, 0.2, 0.4, 0.2, 0.3, 0.2, 0.4, …
#> $ ts        <dbl> 5.6, 6.3, 6.9, 6.3, 6.4, 6.3, 5.9, 6.1, 4.8, 5.9, 7.6, 9.5, …
#> $ pres_nmar <dbl> 1025.4, 1025.4, 1025.2, 1024.9, 1024.5, 1024.2, 1024.1, 1023…
#> $ tamin     <dbl> 7.3, 7.2, 7.2, 7.1, 6.8, 6.7, 6.3, 6.3, 6.0, 5.8, 5.9, 7.2, …
#> $ ta        <dbl> 7.3, 7.2, 7.4, 7.1, 6.8, 6.7, 6.4, 6.4, 6.0, 5.9, 7.2, 8.4, …
#> $ tamax     <dbl> 7.8, 7.3, 7.4, 7.4, 7.2, 6.8, 6.7, 6.4, 6.5, 6.1, 7.2, 8.4, …
#> $ tpr       <dbl> 5.1, 5.1, 5.0, 4.6, 4.6, 4.5, 4.6, 4.5, 4.1, 4.1, 4.8, 4.8, …
#> $ stddv     <dbl> 16, 8, 5, 6, 9, 30, 27, 8, 10, 21, 14, 11, 17, 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.0, 0.0, 4.1, …
#> $ tss5cm    <dbl> 8.1, 7.8, 7.7, 7.6, 7.3, 7.2, 7.1, 7.0, 6.8, 6.6, 6.9, 7.4, …
#> $ pacutp    <dbl> 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, …
#> $ tss20cm   <dbl> 8.9, 8.8, 8.7, 8.6, 8.5, 8.4, 8.3, 8.2, 8.1, 8.0, 7.9, 7.8, …
#> $ rviento   <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 34, 18, …