Get AEMET alert zones.
Source
https://www.aemet.es/es/eltiempo/prediccion/avisos/ayuda. See also Annex 2 and Annex 3 docs, linked in this page.
Details
The first result of the call on each session is (temporarily) cached in
the assigned tempdir()
for avoiding unneeded API calls.
See also
Other aemet_api_data:
aemet_alerts()
,
aemet_beaches()
,
aemet_daily_clim()
,
aemet_extremes_clim()
,
aemet_forecast_beaches()
,
aemet_forecast_daily()
,
aemet_forecast_fires()
,
aemet_last_obs()
,
aemet_monthly
,
aemet_normal
,
aemet_stations()
Examples
library(tibble)
alert_zones <- aemet_alert_zones()
alert_zones
#> # A tibble: 233 × 6
#> COD_Z NOM_Z COD_PROV NOM_PROV COD_CCAA NOM_CCAA
#> <chr> <chr> <chr> <chr> <chr> <chr>
#> 1 610401 Valle del Almanzora y Los Vélez 6104 Almería 61 Andalucía
#> 2 610402 Nacimiento y Campo de Tabernas 6104 Almería 61 Andalucía
#> 3 610403 Poniente y Almería Capital 6104 Almería 61 Andalucía
#> 4 610404 Levante almeriense 6104 Almería 61 Andalucía
#> 5 611101 Grazalema 6111 Cádiz 61 Andalucía
#> 6 611102 Campiña gaditana 6111 Cádiz 61 Andalucía
#> 7 611103 Litoral gaditano 6111 Cádiz 61 Andalucía
#> 8 611104 Estrecho 6111 Cádiz 61 Andalucía
#> 9 611401 Sierra y Pedroches 6114 Córdoba 61 Andalucía
#> 10 611402 Campiña cordobesa 6114 Córdoba 61 Andalucía
#> # ℹ 223 more rows
# Cached during this R session
alert_zones2 <- aemet_alert_zones(verbose = TRUE)
#> Loading alert zones from temporal cached file saved at 2024-11-27 12:51:26 UTC
identical(alert_zones, alert_zones2)
#> [1] TRUE
# Select an map beaches
library(dplyr)
library(ggplot2)
# Galicia
alert_zones_sf <- aemet_alert_zones(return_sf = TRUE) %>%
filter(COD_CCAA == "71")
# Coast zones are identified by a "C" in COD_Z
alert_zones_sf$type <- ifelse(grepl("C$", alert_zones_sf$COD_Z),
"Coast", "Mainland"
)
ggplot(alert_zones_sf) +
geom_sf(aes(fill = NOM_PROV)) +
facet_wrap(~type) +
scale_fill_brewer(palette = "Blues")