Get a database of daily weather forecasts for a beach. Beach database can
be accessed with aemet_beaches()
.
Usage
aemet_forecast_beaches(
x,
verbose = FALSE,
return_sf = FALSE,
extract_metadata = FALSE,
progress = TRUE
)
Arguments
- x
A vector of beaches codes to extract. See
aemet_beaches()
.- 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.
API Key
You need to set your API Key globally using aemet_api_key()
.
See also
aemet_beaches()
for beaches codes.
Other aemet_api_data:
aemet_alert_zones()
,
aemet_alerts()
,
aemet_beaches()
,
aemet_daily_clim()
,
aemet_extremes_clim()
,
aemet_forecast_daily()
,
aemet_forecast_fires()
,
aemet_last_obs()
,
aemet_monthly
,
aemet_normal
,
aemet_stations()
Other forecasts:
aemet_forecast_daily()
,
aemet_forecast_fires()
,
aemet_forecast_tidy()
Examples
# Forecast for beaches in Palma, Mallorca
library(dplyr)
library(ggplot2)
palma_b <- aemet_beaches() %>%
filter(ID_MUNICIPIO == "07040")
forecast_b <- aemet_forecast_beaches(palma_b$ID_PLAYA)
glimpse(forecast_b)
#> Rows: 6
#> Columns: 36
#> $ elaborado <dttm> 2024-11-27 09:00:23, 2024-11-27 09:00:23, 20…
#> $ id <chr> "0704001", "0704001", "0704001", "0704007", "…
#> $ localidad <chr> "07040", "07040", "07040", "07040", "07040", …
#> $ fecha <date> 2024-11-27, 2024-11-28, 2024-11-29, 2024-11-…
#> $ nombre <chr> "Cala Major", "Cala Major", "Cala Major", "Pl…
#> $ estadoCielo_value <lgl> NA, NA, NA, NA, NA, NA
#> $ estadoCielo_f1 <int> 120, 110, 110, 120, 110, 100
#> $ estadoCielo_descripcion1 <chr> "muy nuboso", "nuboso", "nuboso", "muy nuboso…
#> $ estadoCielo_f2 <int> 100, 100, 100, 110, 100, 100
#> $ estadoCielo_descripcion2 <chr> "despejado", "despejado", "despejado", "nubos…
#> $ viento_value <lgl> NA, NA, NA, NA, NA, NA
#> $ viento_f1 <int> 210, 210, 220, 210, 210, 210
#> $ viento_descripcion1 <chr> "flojo", "flojo", "moderado", "flojo", "flojo…
#> $ viento_f2 <int> 210, 210, 210, 210, 210, 210
#> $ viento_descripcion2 <chr> "flojo", "flojo", "flojo", "flojo", "flojo", …
#> $ oleaje_value <lgl> NA, NA, NA, NA, NA, NA
#> $ oleaje_f1 <int> 310, 310, 310, 310, 310, 310
#> $ oleaje_descripcion1 <chr> "débil", "débil", "débil", "débil", "débil", …
#> $ oleaje_f2 <int> 310, 310, 310, 310, 310, 310
#> $ oleaje_descripcion2 <chr> "débil", "débil", "débil", "débil", "débil", …
#> $ tMaxima_value <lgl> NA, NA, NA, NA, NA, NA
#> $ tMaxima_valor1 <int> 20, 19, 21, 19, 19, 20
#> $ sTermica_value <lgl> NA, NA, NA, NA, NA, NA
#> $ sTermica_valor1 <int> 450, 450, 450, 450, 450, 450
#> $ sTermica_descripcion1 <chr> "suave", "suave", "suave", "suave", "suave", …
#> $ tAgua_value <lgl> NA, NA, NA, NA, NA, NA
#> $ tAgua_valor1 <int> 19, 20, 19, 19, 19, 20
#> $ uvMax_value <lgl> NA, NA, NA, NA, NA, NA
#> $ uvMax_valor1 <int> 2, 2, 2, 2, 2, 2
#> $ tmaxima_value <lgl> NA, NA, NA, NA, NA, NA
#> $ tmaxima_valor1 <int> 20, 19, 21, 19, 19, 20
#> $ stermica_value <lgl> NA, NA, NA, NA, NA, NA
#> $ stermica_valor1 <int> 450, 450, 450, 450, 450, 450
#> $ stermica_descripcion1 <chr> "suave", "suave", "suave", "suave", "suave", …
#> $ tagua_value <lgl> NA, NA, NA, NA, NA, NA
#> $ tagua_valor1 <int> 19, 20, 19, 19, 19, 20
ggplot(forecast_b) +
geom_line(aes(fecha, tagua_valor1, color = nombre)) +
facet_wrap(~nombre, ncol = 1) +
labs(
title = "Water temperature in beaches of Palma (ES)",
subtitle = "Forecast 3-days",
x = "Date",
y = "Temperature (Celsius)",
color = "Beach"
)