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
TRUE
orFALSE
. Should the function return ansf
spatial object? IfFALSE
(the default value) it returns atibble
. Note that you need to have the sf package installed.- extract_metadata
Logical
TRUE/FALSE
. OnTRUE
the output is atibble
with the description of the fields. See alsoget_metadata_aemet()
.- progress
Logical, display a
cli::cli_progress_bar()
object. Ifverbose = TRUE
won't be displayed.
Details
start
and end
parameters should be:
For
aemet_daily_clim()
: ADate
object 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-04-09, 2025-04-10, 2025-04-11, 2025-04-12, 2025-04-0…
#> $ 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> 18.4, 17.6, 14.0, 15.2, 18.6, 18.2, 13.2, 13.8
#> $ prec <dbl> 0.0, 0.0, 0.4, 3.8, 0.0, 0.0, 11.3, 4.5
#> $ tmin <dbl> 11.0, 12.8, 10.7, 9.4, 12.6, 13.0, 10.7, 10.8
#> $ horatmin <time> 05:40:00, 23:59:00, 04:20:00, 04:20:00, 06:50:00, 05:20:00…
#> $ tmax <dbl> 25.8, 22.4, 17.4, 21.0, 24.6, 23.5, 15.7, 16.7
#> $ horatmax <time> 16:20:00, 15:20:00, 15:40:00, 15:10:00, 15:10:00, 13:40:00…
#> $ dir <chr> "24", "14", "14", "20", "10", "32", "05", "04"
#> $ velmedia <dbl> 1.4, 4.4, 3.9, 4.2, 2.2, 3.6, 2.5, 1.7
#> $ racha <dbl> 8.6, 10.3, 11.7, 10.3, 6.7, 10.6, 8.1, 6.4
#> $ horaracha <time> 20:10:00, 18:00:00, 16:50:00, 17:50:00, 04:00:00, 17:00:00…
#> $ sol <dbl> 12.1, 5.6, 0.1, 6.0, NA, NA, NA, NA
#> $ presMax <dbl> 989.4, 990.3, 990.2, 983.6, 941.6, 941.0, 940.7, 935.0
#> $ horaPresMax <chr> "00", "10", "00", "00", "01", "24", "00", "00"
#> $ presMin <dbl> 983.7, 987.1, 983.4, 977.6, 936.9, 937.2, 933.6, 931.5
#> $ horaPresMin <chr> "18", "Varias", "23", "16", "18", "16", "17", "16"
#> $ hrMedia <dbl> 62, 68, 80, 77, 40, 49, 75, 85
#> $ hrMax <dbl> 93, 91, 93, 98, 61, 68, 96, 98
#> $ horaHrMax <chr> "Varias", "06:30", "05:50", "Varias", "04:00", "05:10", "2…
#> $ hrMin <dbl> 31, 49, 59, 53, 25, 34, 62, 75
#> $ horaHrMin <chr> "16:40", "15:20", "16:40", "Varias", "Varias", "11:40", "…
# 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…