Skip to contents

Get last observation values for a station.

Usage

aemet_last_obs(
  station = "all",
  verbose = FALSE,
  return_sf = FALSE,
  extract_metadata = FALSE
)

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().

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: 47
#> 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-04-16 13:00:00, 2024-04-16 14:00:00, 2024-04-16 15: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> 19.1, 18.6, 17.8, 19.5, 18.8, 16.1, 15.1, 12.0, 9.6, 12.0, 1…
#> $ vv        <dbl> 11.8, 12.7, 11.3, 11.6, 11.1, 7.1, 8.8, 6.7, 5.1, 7.8, 10.2,…
#> $ dv        <dbl> 318, 315, 322, 323, 323, 333, 318, 315, 299, 310, 309, 318, …
#> $ lat       <dbl> 41.66056, 41.66056, 41.66056, 41.66056, 41.66056, 41.66056, …
#> $ dmax      <dbl> 303, 313, 305, 318, 333, 320, 320, 353, 308, 310, 315, 318, …
#> $ ubi       <chr> "ZARAGOZA  AEROPUERTO", "ZARAGOZA  AEROPUERTO", "ZARAGOZA  A…
#> $ pres      <dbl> 989.1, 988.6, 987.8, 987.6, 987.9, 988.5, 989.3, 990.0, 990.…
#> $ hr        <dbl> 46, 45, 44, 43, 44, 47, 50, 54, 57, 58, 59, 63, 69, 69, 69, …
#> $ stdvv     <dbl> 2.9, 2.1, 2.4, 2.2, 1.9, 1.8, 1.5, 1.4, 0.8, 1.1, 1.3, 1.3, …
#> $ ts        <dbl> 21.2, 22.3, 21.5, 20.1, 18.2, 15.7, 13.4, 12.5, 12.0, 11.9, …
#> $ pres_nmar <dbl> 1018.8, 1018.2, 1017.4, 1017.3, 1017.7, 1018.5, 1019.4, 1020…
#> $ tamin     <dbl> 16.9, 17.0, 17.3, 16.9, 16.1, 14.4, 13.1, 12.3, 11.8, 11.7, …
#> $ ta        <dbl> 17.4, 17.7, 17.6, 17.0, 16.1, 14.4, 13.1, 12.4, 11.8, 11.9, …
#> $ tamax     <dbl> 18.0, 18.1, 18.2, 17.9, 17.0, 16.1, 14.5, 13.2, 12.4, 11.9, …
#> $ tpr       <dbl> 5.6, 5.6, 5.1, 4.3, 3.8, 3.2, 2.9, 3.4, 3.6, 3.9, 3.8, 4.5, …
#> $ stddv     <dbl> 11, 9, 11, 10, 10, 11, 9, 10, 10, 7, 8, 8, 7, 6, 6, 5, 5, 10…
#> $ inso      <dbl> 49.3, 58.7, 59.4, 60.0, 60.0, 60.0, 29.7, 0.0, 0.0, 0.0, 0.0…
#> $ tss5cm    <dbl> 21.4, 22.2, 22.7, 22.6, 22.1, 21.3, 20.3, 19.5, 18.8, 18.2, …
#> $ pacutp    <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
#> $ tss20cm   <dbl> 18.7, 18.9, 19.2, 19.5, 19.8, 20.0, 20.1, 20.1, 20.0, 19.9, …
#> $ rviento   <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, …