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-09-04 00:00:00, 2024-09-04 01:00:00, 2024-09-04 02:00:…
#> $ prec      <dbl> 0.0, 0.0, 0.2, 0.2, 0.2, 0.0, 0.0, 0.0, 0.2, 0.2, 0.6, 0.8, …
#> $ alt       <dbl> 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, …
#> $ vmax      <dbl> 8.2, 8.7, 9.5, 7.5, 6.3, 8.1, 10.9, 9.2, 11.0, 8.8, 11.4, 12…
#> $ vv        <dbl> 5.3, 5.6, 5.7, 3.8, 4.3, 5.9, 6.1, 3.6, 7.0, 6.2, 6.9, 8.2, …
#> $ dv        <dbl> 300, 297, 297, 294, 309, 308, 308, 329, 313, 310, 319, 308, …
#> $ lat       <dbl> 41.66056, 41.66056, 41.66056, 41.66056, 41.66056, 41.66056, …
#> $ dmax      <dbl> 305, 293, 310, 298, 305, 313, 315, 320, 325, 313, 323, 293, …
#> $ ubi       <chr> "ZARAGOZA  AEROPUERTO", "ZARAGOZA  AEROPUERTO", "ZARAGOZA  A…
#> $ pres      <dbl> 986.9, 987.1, 986.7, 987.1, 986.1, 985.9, 986.8, 987.0, 987.…
#> $ hr        <dbl> 84, 86, 88, 89, 88, 88, 91, 89, 90, 93, 93, 92, 83, 73, 74, …
#> $ stdvv     <dbl> 0.7, 0.9, 0.8, 0.4, 0.9, 0.8, 0.8, 1.1, 1.1, 0.8, 1.3, 1.3, …
#> $ ts        <dbl> 19.0, 18.8, 18.1, 18.1, 18.0, 17.8, 17.5, 18.4, 19.0, 18.1, …
#> $ pres_nmar <dbl> 1016.2, 1016.4, 1016.1, 1016.5, 1015.5, 1015.3, 1016.3, 1016…
#> $ tamin     <dbl> 19.1, 18.8, 18.3, 18.2, 18.2, 18.0, 17.6, 17.6, 17.8, 17.7, …
#> $ ta        <dbl> 19.1, 19.0, 18.3, 18.3, 18.2, 18.0, 17.6, 17.9, 18.3, 17.7, …
#> $ tamax     <dbl> 19.7, 19.1, 19.0, 18.3, 18.4, 18.2, 18.0, 17.9, 18.4, 18.3, …
#> $ tpr       <dbl> 16.3, 16.6, 16.3, 16.5, 16.1, 16.0, 16.1, 16.0, 16.6, 16.6, …
#> $ stddv     <dbl> 7, 8, 6, 6, 8, 7, 8, 15, 9, 8, 10, 8, 10, NA, NA, NA, NA, NA…
#> $ inso      <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, NA, NA, NA, NA, NA, N…
#> $ tss5cm    <dbl> 21.1, 20.9, 20.7, 20.5, 20.4, 20.1, 19.9, 19.9, 20.4, 20.6, …
#> $ pacutp    <dbl> 0.04, 0.11, 0.30, 0.21, 0.08, 0.00, 0.03, 0.00, 0.37, 0.32, …
#> $ tss20cm   <dbl> 24.8, 24.6, 24.4, 24.2, 24.1, 23.9, 23.7, 23.5, 23.4, 23.3, …
#> $ rviento   <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 139, 113…