aemet_forecast_beaches: Beach forecast dataset

View source: R/aemet-forecast-beach.R

aemet_forecast_beachesR Documentation

Beach forecast dataset

Description

Get daily weather forecasts for one or more beaches. Beach codes can be accessed with aemet_beaches().

Usage

aemet_forecast_beaches(
  x,
  verbose = FALSE,
  return_sf = FALSE,
  extract_metadata = FALSE,
  progress = TRUE
)

Arguments

x

Character vector with beach codes to extract. See aemet_beaches().

verbose

Logical. If TRUE, provides information about the flow of information between the client and server.

return_sf

Logical. If TRUE, the function returns an sf spatial object. If FALSE (the default value), it returns a tibble. The sf package must be installed.

extract_metadata

Logical. If TRUE, the output is a tibble with the description of the fields. See also get_metadata_aemet().

progress

Logical. Displays a cli::cli_progress_bar() object. If verbose = TRUE, it will not be displayed.

Value

A tibble or a sf object.

API key

You need to set your API key globally using aemet_api_key(). Query timeout can be controlled with options(climaemet_timeout = 60) (default value). See httr2::req_timeout() for details.

See Also

aemet_beaches() for beach codes.

AEMET data functions: 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()

Forecast functions: 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)

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 = "3-day forecast",
    x = "Date",
    y = "Temperature (Celsius)",
    color = "Beach"
  )


climaemet documentation built on June 3, 2026, 5:07 p.m.