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-09-04 08:00:28, 2024-09-04 08:00:28, 20…
#> $ id <chr> "0704001", "0704001", "0704001", "0704007", "…
#> $ localidad <chr> "07040", "07040", "07040", "07040", "07040", …
#> $ fecha <date> 2024-09-04, 2024-09-05, 2024-09-06, 2024-09-…
#> $ nombre <chr> "Cala Major", "Cala Major", "Cala Major", "Pl…
#> $ estadoCielo_value <lgl> NA, NA, NA, NA, NA, NA
#> $ estadoCielo_f1 <int> 110, 110, 100, -126, 110, 110
#> $ estadoCielo_descripcion1 <chr> "nuboso", "nuboso", "despejado", "chubascos",…
#> $ estadoCielo_f2 <int> 130, 100, 100, 130, 100, 100
#> $ estadoCielo_descripcion2 <chr> "chubascos", "despejado", "despejado", "chuba…
#> $ viento_value <lgl> NA, NA, NA, NA, NA, NA
#> $ viento_f1 <int> 210, 210, 220, 210, 210, 220
#> $ viento_descripcion1 <chr> "flojo", "flojo", "moderado", "flojo", "flojo…
#> $ viento_f2 <int> 210, 210, 220, 210, 210, 210
#> $ viento_descripcion2 <chr> "flojo", "flojo", "moderado", "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> 27, 27, 30, 28, 28, 30
#> $ sTermica_value <lgl> NA, NA, NA, NA, NA, NA
#> $ sTermica_valor1 <int> 460, 460, 470, 460, 460, 470
#> $ sTermica_descripcion1 <chr> "calor agradable", "calor agradable", "calor …
#> $ tAgua_value <lgl> NA, NA, NA, NA, NA, NA
#> $ tAgua_valor1 <int> 28, 28, 28, 27, 26, 27
#> $ uvMax_value <lgl> NA, NA, NA, NA, NA, NA
#> $ uvMax_valor1 <int> 7, 7, 7, 7, 7, 7
#> $ stermica_value <lgl> NA, NA, NA, NA, NA, NA
#> $ stermica_valor1 <int> 460, 460, 470, 460, 460, 470
#> $ stermica_descripcion1 <chr> "calor agradable", "calor agradable", "calor …
#> $ tagua_value <lgl> NA, NA, NA, NA, NA, NA
#> $ tagua_valor1 <int> 28, 28, 28, 27, 26, 27
#> $ tmaxima_value <lgl> NA, NA, NA, NA, NA, NA
#> $ tmaxima_valor1 <int> 27, 27, 30, 28, 28, 30
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"
)