MyNixOS website logo
Description

Identify and Characterize Drought Events from Drought Index Time Series.

Detects, describes, and analyzes drought events from time series of drought indices, such as the Standardized Precipitation-Evapotranspiration Index (SPEI). Identifies drought episodes based on threshold values and calculates their duration, intensity, severity, and peak month. Includes utilities for summarizing and visualizing drought dynamics over time. The Standardized Precipitation-Evapotranspiration Index is described in Vicente-Serrano et al. (2010) <doi:10.1175/2009JCLI2909.1>.

dRoughteventsdroughtevents website

Overview

droughtevents provides tools to detect, summarize, and visualize drought events from drought-related index time series (e.g., SPEI, SPI). Given a time series and a threshold, the package identifies periods of sustained below-threshold values, computes summary statistics for each event (duration, intensity, severity, timing), and offers ggplot2-based plotting functions to visualize the time series and highlight the detected events.

Installation

You can install the development version of droughtevents from GitHub with:

# install.packages("remotes")
remotes::install_github("ajpelu/droughtevents")

Usage

library(droughtevents)
library(ggplot2)

Detect drought events

droughts() identifies drought events in a time series when a given index falls below a specified threshold for at least min_duration consecutive months (2 by default).

data(spei_granada)

result <- droughts(spei_granada, vname = "spei12", threshold = -1.28)

result$drought_assessment
#> # A tibble: 17 × 9
#>    index_events d_duration d_intensity d_severity lowest_spei month_peak minyear
#>           <int>      <dbl>       <dbl>      <dbl>       <dbl>      <dbl>   <dbl>
#>  1            3         11       -1.93       21.2        -2.3         10    1945
#>  2            5          4       -1.45        5.8        -1.6          5    1949
#>  3            7          2       -1.45        2.9        -1.5         12    1950
#>  4           11          2       -1.35        2.7        -1.4          6    1965
#>  5           21         14       -1.83       25.6        -2.2         10    1994
#>  6           23          9       -1.63       14.7        -1.9          6    1998
#>  7           27          7       -1.64       11.5        -1.7          7    2005
#>  8           29          9       -1.92       17.3        -2.2          8    2012
#>  9           31          5       -1.38        6.9        -1.5          5    2014
#> 10           33          5       -1.64        8.2        -1.9          3    2015
#> 11           35          3       -1.5         4.5        -1.7         10    2016
#> 12           37         11       -1.6        17.6        -2.1         12    2017
#> 13           39         11       -1.7        18.7        -2           10    2019
#> 14           41          2       -1.5         3          -1.7         12    2020
#> 15           43         21       -1.58       33.2        -2.1          1    2021
#> 16           45         12       -1.91       22.9        -2.4          1    2023
#> 17           47          5       -1.54        7.7        -1.7          9    2024
#> # ℹ 2 more variables: maxyear <dbl>, rangeDate <chr>

The returned object is a named list with three elements:

  • data: the original data, with drought flags and durations added.
  • drought_events: only the rows that belong to a detected drought event.
  • drought_assessment: one row per event, with its duration, intensity, severity, and timing.

Plot the time series

plot_drought_ts() draws the index as a bar plot, coloring positive (wet, blue) and negative (dry, red) periods differently.

plot_drought_ts(spei_granada, vname = "spei12", title = "SPEI-12 Time Series")

You can also aggregate by year:

plot_drought_ts(spei_granada, vname = "spei12", by_year = TRUE)

Highlight drought events on the plot

add_drought_events() overlays the detected events on top of a plot created with plot_drought_ts(), as shaded bands or vertical lines, or both.

p <- plot_drought_ts(spei_granada, vname = "spei12", title = "SPEI-12 Time Series")

p |>
  add_drought_events(
    drought_assessment = result$drought_assessment,
    which_events = "top",
    metric = "severity",
    top_n = 5,
    type = "both",
    show_severity = FALSE
  )

Data

The package ships with spei_granada, a monthly SPEI time series (6, 12, 24, and 48-month scales) for Granada, Spain, covering 1901-2024. See ?spei_granada for details and the data source.

References

Vicente-Serrano, S.M., Beguería, S., López-Moreno, J.I. (2010). A Multiscalar Drought Index Sensitive to Global Warming: The Standardized Precipitation Evapotranspiration Index. Journal of Climate, 23(7), 1696-1718. 10.1175/2009JCLI2909.1

License.

Metadata

Version

0.1.0

License

Unknown

Platforms (79)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    uefi
    wasip1
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-uefi
  • aarch64-windows
  • aarch64_be-none
  • arc-linux
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-linux
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • sh4-linux
  • vc4-none
  • wasm32-wasip1
  • wasm64-wasip1
  • x86_64-cygwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-uefi
  • x86_64-windows