Get climatology values for a station or for all the available stations.
Note that aemet_daily_period() and aemet_daily_period_all() are shortcuts
of aemet_daily_clim().
Usage
aemet_daily_clim(
station = "all",
start = Sys.Date() - 7,
end = Sys.Date(),
verbose = FALSE,
return_sf = FALSE,
extract_metadata = FALSE,
progress = TRUE
)
aemet_daily_period(
station,
start = as.integer(format(Sys.Date(), "%Y")),
end = start,
verbose = FALSE,
return_sf = FALSE,
extract_metadata = FALSE,
progress = TRUE
)
aemet_daily_period_all(
start = as.integer(format(Sys.Date(), "%Y")),
end = start,
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.- start, end
Character string with start and end date. See Details.
- verbose
Logical
TRUE/FALSE. Provides information about the flow of information between the client and server.- return_sf
Logical
TRUEorFALSE. Should the function return ansfspatial object? IfFALSE(the default value) it returns atibble. Note that you need to have the sf package installed.- extract_metadata
Logical
TRUE/FALSE. OnTRUEthe output is atibblewith the description of the fields. See alsoget_metadata_aemet().- progress
Logical, display a
cli::cli_progress_bar()object. Ifverbose = TRUEwon't be displayed.
Details
start and end parameters should be:
For
aemet_daily_clim(): ADateobject or a string with format:YYYY-MM-DD("2020-12-31") coercible withas.Date().For
aemet_daily_period()andaemet_daily_period_all(): A string representing the year(s) to be extracted:"2020","2018".
API Key
You need to set your API Key globally using aemet_api_key().
See also
Other aemet_api_data:
aemet_alert_zones(),
aemet_alerts(),
aemet_beaches(),
aemet_extremes_clim(),
aemet_forecast_beaches(),
aemet_forecast_daily(),
aemet_forecast_fires(),
aemet_last_obs(),
aemet_monthly,
aemet_normal,
aemet_stations()
Examples
library(tibble)
obs <- aemet_daily_clim(c("9434", "3195"))
glimpse(obs)
#> Rows: 8
#> Columns: 25
#> $ fecha <date> 2025-10-29, 2025-10-30, 2025-10-31, 2025-11-01, 2025-10-2…
#> $ indicativo <chr> "9434", "9434", "9434", "9434", "3195", "3195", "3195", "3…
#> $ nombre <chr> "ZARAGOZA, AEROPUERTO", "ZARAGOZA, AEROPUERTO", "ZARAGOZA,…
#> $ provincia <chr> "ZARAGOZA", "ZARAGOZA", "ZARAGOZA", "ZARAGOZA", "MADRID", …
#> $ altitud <dbl> 249, 249, 249, 249, 667, 667, 667, 667
#> $ tmed <dbl> 13.5, 17.7, 17.1, 17.1, NA, NA, NA, NA
#> $ prec <dbl> 0.6, 0.0, 0.0, 0.0, 3.7, 0.1, 0.0, 0.0
#> $ tmin <dbl> 10.9, 11.6, 11.8, 12.1, NA, NA, NA, NA
#> $ horatmin <time> 00:40:00, 06:40:00, 04:30:00, 06:10:00, NA, NA…
#> $ tmax <dbl> 16.1, 23.8, 22.4, 22.1, NA, NA, NA, NA
#> $ horatmax <time> 14:40:00, 15:10:00, 14:00:00, 14:40:00, NA, NA…
#> $ dir <chr> "12", "27", "21", "22", "99", "06", "05", "07"
#> $ velmedia <dbl> 2.2, 3.6, 2.5, 4.4, 0.0, 1.4, 1.4, 1.7
#> $ racha <dbl> 6.1, 8.1, 9.4, 11.9, 5.6, 5.6, 4.2, 8.6
#> $ horaracha <time> 08:40:00, 13:00:00, 12:50:00, 20:00:00, 00:50:00, 15:40:00…
#> $ sol <dbl> 0.1, 9.7, 3.2, 1.1, NA, NA, NA, NA
#> $ presMax <dbl> 982.6, 983.9, 986.3, 987.9, 935.2, 938.8, 940.0, 943.1
#> $ horaPresMax <chr> "00", "22", "10", "11", "00", "23", "Varias", "23"
#> $ presMin <dbl> 977.5, 980.8, 983.6, 985.1, 930.8, 934.9, 938.0, 939.2
#> $ horaPresMin <chr> "17", "15", "01", "02", "16", "00", "06", "Varias"
#> $ hrMedia <dbl> 94, 65, 64, 66, NA, NA, NA, NA
#> $ hrMax <dbl> 99, 97, 89, 90, NA, NA, NA, NA
#> $ horaHrMax <chr> "Varias", "00:00", "03:40", "05:30", NA, NA, NA, NA
#> $ hrMin <dbl> 74, 39, 43, 49, NA, NA, NA, NA
#> $ horaHrMin <time> 00:00:00, 15:10:00, 13:40:00, 13:40:00, NA, NA…
# Metadata
meta <- aemet_daily_clim(c("9434", "3195"), extract_metadata = TRUE)
glimpse(meta$campos)
#> Rows: 25
#> Columns: 5
#> $ id <chr> "fecha", "indicativo", "nombre", "provincia", "altitud", "…
#> $ descripcion <chr> "fecha del dia (AAAA-MM-DD)", "indicativo climatológico", …
#> $ tipo_datos <chr> "string", "string", "string", "string", "float", "float", …
#> $ requerido <lgl> TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, …
#> $ unidad <chr> NA, NA, NA, NA, "m", "°C", "mm (Ip = inferior a 0,1 mm) (A…
