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> 2024-07-17 00:00:00, 2024-07-17 01:00:00, 2024-07-17 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, 11.8, 10.5, 10.4, 8.8, 6.1, 5.5, 6.6, 5.9, 4.9, 4.0, 4…
#> $ vv        <dbl> 9.2, 7.9, 8.0, 7.2, 5.3, 4.6, 4.2, 4.7, 2.9, 1.5, 2.1, 1.6, …
#> $ dv        <dbl> 296, 304, 297, 306, 290, 291, 303, 310, 315, 302, 127, 67, 1…
#> $ lat       <dbl> 41.66056, 41.66056, 41.66056, 41.66056, 41.66056, 41.66056, …
#> $ dmax      <dbl> 310, 305, 318, 290, 308, 298, 303, 315, 308, 305, 113, 110, …
#> $ ubi       <chr> "ZARAGOZA  AEROPUERTO", "ZARAGOZA  AEROPUERTO", "ZARAGOZA  A…
#> $ pres      <dbl> 988.9, 988.8, 988.7, 989.0, 989.3, 989.7, 990.2, 990.4, 990.…
#> $ hr        <dbl> 60, 62, 62, 63, 65, 66, 65, 62, 58, 52, 52, 48, 43, 25, 25, …
#> $ stdvv     <dbl> 1.0, 0.9, 0.9, 0.9, 0.6, 0.4, 0.5, 0.5, 0.6, 0.6, 0.9, 0.7, …
#> $ ts        <dbl> 21.5, 20.6, 20.2, 19.7, 19.3, 19.1, 20.9, 24.4, 26.7, 29.8, …
#> $ pres_nmar <dbl> 1018.1, 1018.1, 1018.0, 1018.4, 1018.8, 1019.2, 1019.7, 1019…
#> $ tamin     <dbl> 20.8, 20.1, 19.8, 19.4, 18.8, 18.6, 18.5, 18.9, 19.7, 20.9, …
#> $ ta        <dbl> 20.8, 20.2, 19.8, 19.4, 18.8, 18.6, 18.9, 19.7, 21.0, 22.7, …
#> $ tamax     <dbl> 21.9, 20.8, 20.2, 19.8, 19.4, 18.8, 19.0, 19.8, 21.0, 22.7, …
#> $ tpr       <dbl> 12.7, 12.6, 12.3, 12.2, 12.1, 12.1, 12.2, 12.2, 12.4, 12.3, …
#> $ stddv     <dbl> 6, 7, 6, 6, 5, 6, 9, 12, 18, 36, 37, 48, 23, NA, NA, NA, NA,…
#> $ inso      <dbl> 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 24.1, 59.3, 60.0, 60.0, 60.0, …
#> $ tss5cm    <dbl> 32.2, 31.4, 30.6, 30.0, 29.4, 28.8, 28.4, 28.5, 29.3, 30.8, …
#> $ pacutp    <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NA, NA, NA, NA, NA, N…
#> $ tss20cm   <dbl> 34.3, 33.9, 33.5, 33.1, 32.7, 32.3, 31.9, 31.5, 31.2, 30.9, …
#> $ rviento   <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 19, 69, …