trans_thornthwaite {tidyindex}R Documentation

Drought-related index functions

Description

The functions are used for quick computing of some common drought indexes built from wrappers of the underlying modules. For more customised needs, users may build their own indexes from the modules.

Usage

trans_thornthwaite(var, lat, na.rm = FALSE, verbose = TRUE)

idx_spi(data, .prcp, .dist = dist_gamma(), .scale = 12)

idx_spei(
  data,
  .tavg,
  .lat,
  .prcp,
  .pet_method = trans_thornthwaite(),
  .scale = 12,
  .dist = dist_glo()
)

idx_rdi(
  data,
  .tavg,
  .lat,
  .prcp,
  .pet_method = trans_thornthwaite(),
  .scale = 12
)

idx_edi(data, .tavg, .lat, .prcp, .scale = 12)

Arguments

var

the variable to be transformed, see [tidyindex::variable_trans()] and [SPEI::thornthwaite()]

lat, na.rm, verbose

see [SPEI::thornthwaite]

data

an id_tbl object

.dist

the distribution used for distribution fit, see [tidyindex::distribution_fit()]

.scale

the temporal aggregation scale, see [tidyindex::temporal_aggregation()]

.tavg, .lat, .prcp

variables to be used in the index calculation, see Details

.pet_method

the method used for calculating potential evapotranspitation, currently only trans_thornthwaite()

Details

Below explains the steps wrapped in each index and the intermediate variables created.

The idx_spi() function performs

  1. a temporal aggregation on the input precipitation series, .prcp, as .agg,

  2. a distribution fit step on the aggregated precipitation , .agg, as .fit, and

  3. a normalising step on the fitted values, .fit, as .index

The idx_spei() function performs

  1. a variable transformation step on the inut average temperature, .tavg, to obtain the potential evapotranspiration, .pet,

  2. a dimension reduction step to calculate difference series, .diff, between the input precipitation series, .prcp, and .pet,

  3. a temporal aggregation step on the difference series, .diff, as .agg,

  4. a distribution fit step on the aggregated series, .agg, as .fit, and

  5. a normalising step on the fitted value, .fit, to obtain .index.

The idx_rdi() function performs

  1. a variable transformation step on the input average temperature, .tavg, to obtain potential evapotranspiration .pet,

  2. a dimension reduction step to calculate the ratio of input precipitation, .prcp, to .pet as .ratio,

  3. a temporal aggregation step on the ratio series, .ratio, as .agg

  4. a variable transformation step to take the log10 of the aggregated series, .agg, as .y, and

  5. a rescaling step to rescale .y by zscore to obtain .index.

The idx_edi() function performs

  1. a dimension reduction step to aggregate the input precipitation series, prcp, as .mult,

  2. a temporal aggregation step on the aggregated precipitation series (.mult) as .ep, and

  3. a rescaling step to rescale .ep by zscore to obtain .index.

Value

an index table object

Examples

library(dplyr)
library(lmomco)
dt <- tenterfield |>
  mutate(month = lubridate::month(ym)) |>
  init(id = id, time = ym, group = month)

dt |> idx_spi()
dt |> idx_spi(.scale = c(12, 24))
dt |> idx_spei(.lat = lat, .tavg = tavg)
dt |> idx_rdi(.lat = lat, .tavg = tavg)
dt |> idx_edi(.lat = lat, .tavg = tavg)


[Package tidyindex version 0.1.0 Index]