trans_thornthwaite | R Documentation |
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.
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)
var |
the variable to be transformed, see [tidyindex::variable_trans()] and [SPEI::thornthwaite()] |
lat, na.rm, verbose |
see [SPEI::thornthwaite] |
data |
an |
.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 |
Below explains the steps wrapped in each index and the intermediate variables created.
The idx_spi()
function performs
a temporal aggregation on the input precipitation series,
.prcp
, as .agg
,
a distribution fit step on the aggregated precipitation
, .agg
, as .fit
, and
a normalising step on the fitted values, .fit
, as
.index
The idx_spei()
function performs
a variable transformation step on the inut average temperature,
.tavg
, to obtain the potential evapotranspiration, .pet
,
a dimension reduction step to calculate difference series,
.diff
, between the input precipitation series, .prcp
,
and .pet
,
a temporal aggregation step on the difference series, .diff
,
as .agg
,
a distribution fit step on the aggregated series, .agg
,
as .fit
, and
a normalising step on the fitted value, .fit
, to
obtain .index
.
The idx_rdi()
function performs
a variable transformation step on the input average temperature,
.tavg
, to obtain potential evapotranspiration .pet
,
a dimension reduction step to calculate the ratio of input
precipitation, .prcp
, to .pet
as .ratio
,
a temporal aggregation step on the ratio series, .ratio
, as
.agg
a variable transformation step to take the log10 of the aggregated
series, .agg
, as .y
, and
a rescaling step to rescale .y
by zscore to obtain
.index
.
The idx_edi()
function performs
a dimension reduction step to aggregate the input precipitation
series, prcp
, as .mult
,
a temporal aggregation step on the aggregated precipitation series
(.mult
) as .ep
, and
a rescaling step to rescale .ep
by zscore to obtain
.index
.
an index table object
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.