Skip to contents

Get a SpatRaster with the daily wildfire risk level.

Usage

aemet_forecast_fires(
  area = c("p", "c"),
  verbose = FALSE,
  extract_metadata = FALSE
)

Arguments

area

Forecast area. Accepted values are:

  • "p" for mainland Spain and Balearic Islands.

  • "c" for Canary Islands.

verbose

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

extract_metadata

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

Value

A tibble or a SpatRaster.

Details

The SpatRaster provides six factor() levels with the following meaning:

  • "1": Very low risk.

  • "2": Low risk.

  • "3": Moderate risk.

  • "4": High risk.

  • "5": Very high risk.

  • "6": Extreme risk.

The resulting object has several layers, each one representing the forecast for the upcoming 7 days. It also has additional attributes provided by the terra package, such as terra::time() and terra::coltab().

Examples

aemet_forecast_fires(extract_metadata = TRUE)
#> # A tibble: 1 × 6
#>   unidad_generadora         descripción periodicidad formato copyright notaLegal
#>   <chr>                     <chr>       <chr>        <chr>   <chr>     <chr>    
#> 1 Servicio de Aplicaciones… Mapa de ni… diario       image/… © AEMET.… https://…

# Extract alerts.
alerts <- aemet_forecast_fires()

alerts
#> class       : SpatRaster
#> size        : 922, 1541, 8  (nrow, ncol, nlyr)
#> resolution  : 0.01, 0.01  (x, y)
#> extent      : -10.205, 5.205, 34.995, 44.215  (xmin, xmax, ymin, ymax)
#> coord. ref. : lon/lat WGS 84 (EPSG:4326)
#> source(s)   : memory
#> color table : 1, 2, 3, 4, 5, 6, 7, 8
#> names       : 2026-06-07, 2026-06-08, 2026-06-09, 2026-06-10, 2026-06-11, 2026-06-12, ...
#> min values  :   Very low,   Very low,   Very low,   Very low,   Very low,   Very low, ...
#> max values  :    Extreme,    Extreme,    Extreme,    Extreme,    Extreme,    Extreme, ...
#> time (days) : 2026-06-07 to 2026-06-14 (8 steps)

# Plot with terra.
library(terra)
#> terra 1.9.27
plot(alerts, all_levels = TRUE)


# Zoom in on an area.
cyl <- mapSpain::esp_get_ccaa("Castilla y Leon", epsg = 4326)

# SpatVector
cyl <- vect(cyl)

fires_cyl <- crop(alerts, cyl)
title <- names(fires_cyl)[1]

plot(fires_cyl[[1]], main = title, all_levels = TRUE)
plot(cyl, add = TRUE)