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-11-27 00:00:00, 2024-11-27 01:00:00, 2024-11-27 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> 2.8, 3.4, 1.7, 2.1, 2.0, 2.3, 2.3, 1.5, 1.5, 1.6, 2.8, 3.0, …
#> $ vv        <dbl> 2.5, 0.8, 0.9, 1.6, 0.4, 1.9, 1.2, 0.7, 0.5, 0.7, 1.4, 1.6, …
#> $ dv        <dbl> 244, 252, 347, 244, 341, 272, 245, 357, 284, 19, 310, 322, 3…
#> $ lat       <dbl> 41.66056, 41.66056, 41.66056, 41.66056, 41.66056, 41.66056, …
#> $ dmax      <dbl> 250, 230, 320, 318, 218, 278, 288, 10, 15, 23, 288, 320, 333…
#> $ ubi       <chr> "ZARAGOZA  AEROPUERTO", "ZARAGOZA  AEROPUERTO", "ZARAGOZA  A…
#> $ pres      <dbl> 994.7, 994.4, 994.5, 994.3, 994.3, 994.3, 994.6, 994.9, 995.…
#> $ hr        <dbl> 91, 91, 94, 95, 96, 95, 96, 97, 97, 92, 89, 82, 75, 83, 83, …
#> $ stdvv     <dbl> 0.2, 0.3, 0.4, 0.2, 0.3, 0.2, 0.2, 0.3, 0.1, 0.2, 0.2, 0.5, …
#> $ ts        <dbl> 5.7, 5.2, 3.5, 3.8, 2.6, 2.8, 2.6, 2.0, 2.7, 7.3, 10.5, 13.4…
#> $ pres_nmar <dbl> 1025.6, 1025.4, 1025.5, 1025.5, 1025.5, 1025.6, 1025.9, 1026…
#> $ tamin     <dbl> 6.5, 6.1, 5.5, 4.4, 4.1, 3.4, 3.4, 3.2, 2.7, 3.0, 5.0, 6.6, …
#> $ ta        <dbl> 6.5, 6.1, 5.6, 4.5, 4.1, 3.4, 3.5, 3.2, 3.0, 5.0, 6.6, 9.4, …
#> $ tamax     <dbl> 7.7, 6.5, 6.1, 5.6, 4.5, 4.1, 3.6, 3.5, 3.2, 5.0, 6.6, 9.4, …
#> $ tpr       <dbl> 5.1, 4.8, 4.6, 3.8, 3.6, 2.7, 2.9, 2.9, NA, NA, NA, NA, NA, …
#> $ stddv     <dbl> 4, 45, 35, 8, 26, 5, 14, 23, 18, 31, 9, 21, 16, NA, NA, NA, …
#> $ inso      <dbl> 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 17.8, 59.4, 60.0, 60…
#> $ tss5cm    <dbl> 9.5, 9.1, 8.7, 8.3, 8.0, 7.6, 7.3, 7.0, 6.8, 7.1, 8.2, 9.5, …
#> $ pacutp    <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, NA, NA, NA, NA, NA, NA, NA, NA, N…
#> $ tss20cm   <dbl> 11.9, 11.7, 11.5, 11.4, 11.2, 11.0, 10.8, 10.5, 10.3, 10.1, …
#> $ rviento   <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 92, 75, …