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-04-02 00:00:00, 2025-04-02 01:00:00, 2025-04-02 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> 7.7, 5.7, 7.3, 6.6, 5.5, 5.2, 5.9, 4.6, 7.2, 8.3, 8.9, 9.9, …
#> $ vv        <dbl> 4.2, 1.8, 4.1, 3.7, 3.0, 3.5, 2.0, 2.9, 4.5, 5.5, 6.2, 6.0, …
#> $ dv        <dbl> 109, 94, 118, 120, 124, 114, 127, 141, 131, 127, 122, 135, 1…
#> $ lat       <dbl> 41.66056, 41.66056, 41.66056, 41.66056, 41.66056, 41.66056, …
#> $ dmax      <dbl> 118, 105, 113, 140, 120, 123, 95, 138, 128, 133, 125, 108, 1…
#> $ ubi       <chr> "ZARAGOZA  AEROPUERTO", "ZARAGOZA  AEROPUERTO", "ZARAGOZA  A…
#> $ pres      <dbl> 976.8, 976.8, 976.5, 976.1, 975.9, 975.9, 976.2, 976.3, 976.…
#> $ hr        <dbl> 77, 80, 76, 75, 76, 75, 77, 78, 78, 74, 71, 62, 68, 71, 77, …
#> $ stdvv     <dbl> 0.8, 0.4, 0.7, 0.5, 0.6, 0.6, 0.6, 0.7, 0.9, 1.0, 1.2, 1.1, …
#> $ ts        <dbl> 10.7, 9.9, 11.3, 11.0, 11.0, 10.9, 10.9, 11.4, 12.3, 14.1, 1…
#> $ pres_nmar <dbl> 1006.7, 1006.8, 1006.4, 1006.0, 1005.8, 1005.8, 1006.1, 1006…
#> $ tamin     <dbl> 11.4, 10.9, 10.9, 11.4, 11.3, 11.2, 11.1, 11.1, 11.3, 11.9, …
#> $ ta        <dbl> 11.4, 10.9, 11.6, 11.4, 11.3, 11.2, 11.1, 11.3, 11.9, 12.9, …
#> $ tamax     <dbl> 12.0, 11.4, 11.6, 11.6, 11.4, 11.3, 11.2, 11.3, 11.9, 13.0, …
#> $ tpr       <dbl> 7.6, 7.6, 7.6, 7.1, 7.3, 7.0, 7.3, 7.6, 8.1, 8.4, 9.0, 8.7, …
#> $ stddv     <dbl> 9, 12, 10, 11, 7, 9, 14, 11, 12, 11, 10, 12, 14, NA, NA, NA,…
#> $ inso      <dbl> 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 19.0, 52.2…
#> $ tss5cm    <dbl> 15.2, 14.8, 14.6, 14.4, 14.2, 14.0, 13.8, 13.8, 13.8, 14.0, …
#> $ pacutp    <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NA, NA, NA, NA, NA, N
#> $ tss20cm   <dbl> 15.7, 15.5, 15.4, 15.2, 15.1, 14.9, 14.8, 14.7, 14.6, 14.5, …
#> $ rviento   <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 63, 66, …