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-01-08 00:00:00, 2025-01-08 01:00:00, 2025-01-08 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> 12.1, 10.6, 10.4, 4.0, 3.9, 3.8, 8.4, 5.2, 4.7, 5.1, 5.0, 5.…
#> $ vv        <dbl> 6.7, 6.9, 2.8, 2.8, 2.3, 2.0, 2.7, 2.9, 1.7, 1.5, 3.6, 2.0, …
#> $ dv        <dbl> 249, 242, 122, 96, 91, 107, 108, 124, 89, 87, 126, 95, 122, …
#> $ lat       <dbl> 41.66056, 41.66056, 41.66056, 41.66056, 41.66056, 41.66056, …
#> $ dmax      <dbl> 250, 248, 245, 85, 95, 123, 218, 248, 85, 120, 128, 100, 123…
#> $ ubi       <chr> "ZARAGOZA  AEROPUERTO", "ZARAGOZA  AEROPUERTO", "ZARAGOZA  A…
#> $ pres      <dbl> 988.8, 988.4, 988.9, 988.8, 988.9, 988.8, 988.4, 988.2, 988.…
#> $ hr        <dbl> 69, 69, 77, 83, 85, 86, 76, 80, 85, 86, 87, 84, 82, 90, 88, …
#> $ stdvv     <dbl> 1.0, 1.2, 0.8, 0.6, 0.6, 1.0, 0.9, 0.5, 0.9, 0.8, 0.6, 0.5, …
#> $ ts        <dbl> 10.9, 10.9, 6.2, 5.2, 4.7, 4.7, 7.9, 5.9, 4.7, 5.7, 6.5, 7.4…
#> $ pres_nmar <dbl> 1019.1, 1018.6, 1019.6, 1019.6, 1019.8, 1019.7, 1019.1, 1018…
#> $ tamin     <dbl> 11.4, 11.5, 7.6, 6.0, 5.6, 5.3, 5.3, 7.0, 5.2, 5.3, 5.9, 6.3…
#> $ ta        <dbl> 11.6, 11.6, 7.6, 6.0, 5.6, 5.4, 7.9, 7.2, 5.3, 5.9, 6.3, 6.8…
#> $ tamax     <dbl> 11.6, 11.7, 11.6, 7.6, 7.0, 5.6, 9.3, 9.2, 7.2, 5.9, 6.3, 6.…
#> $ tpr       <dbl> 6.1, 6.1, 3.8, 3.4, 3.2, 3.2, 3.9, 3.9, 3.0, 3.8, 4.3, 4.3, …
#> $ stddv     <dbl> 9, 9, 15, 10, 15, 39, 82, 9, 49, 72, 8, 13, 22, NA, NA, NA, …
#> $ inso      <dbl> 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 21.3, 6.6, 0.0, 0.0,…
#> $ tss5cm    <dbl> 7.5, 7.5, 7.5, 6.9, 6.5, 6.2, 6.2, 6.1, 6.0, 5.9, 6.1, 6.5, …
#> $ pacutp    <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NA, NA, NA, NA, NA, N
#> $ tss20cm   <dbl> 7.8, 7.8, 7.8, 7.8, 7.8, 7.8, 7.7, 7.6, 7.5, 7.4, 7.3, 7.3, …
#> $ rviento   <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 112, 71,…