t.drought - Computes gridded drought indices (SPI, SPEI) as space-time raster datasets, from precipitation/PET STRDS imported via t.in.era5 if not already present.
Drought indices to compute (cdi, lfi, rdri_agro are recognized but not yet implemented -- see t.drought.md ROADMAP)
Options: spi, spei, cdi, lfi, rdri_agro
Default: spi,spei
start=string[required]
Start date of the output period, YYYY-MM-DD
end=string[required]
End date of the output period, YYYY-MM-DD (inclusive)
fit_start=string
Start date of the calibration/reference period used to fit each index's distribution (default: start=). Use as long a baseline as you have data for -- WMO recommends >=30 years -- since start=/end= alone is usually too short for a stable fit.
fit_end=string
End date of the calibration/reference period (default: end=)
aggregation=string
Temporal aggregation level of one index period
Options: daily, weekly, monthly, yearly, custom
Default: monthly
custom_days=integer
Length in days of one aggregation period; required when aggregation=custom
scales=integer[,integer,...]
Accumulation scales, in number of aggregation periods (with aggregation=monthly, 1,3,6,12,24,48 give the standard SPI-1/SPI-3/.../SPI-48 series; with other aggregation levels these are generalized N-period accumulations, not literal months)
Default: 1,3,6,12,24,48
region=name
Named region to process into (g.region region=); default is the current computational region
precipitation=name
Existing precipitation STRDS (mm per day); if not given, imported via t.in.era5
pet=name
Existing potential evapotranspiration STRDS (mm per day), needed for spei; if not given, imported via t.in.era5 (ERA5 reanalysis PET)
output_prefix=string[required]
STRDS name prefix; outputs are <output_prefix>_<index><scale>, e.g. drought_spi3
Default: drought
cache_dir=name
Directory to cache t.in.era5 downloads in (only used when precipitation=/pet= are not given); default a temporary directory
area=north,west,south,east
Bounding box in WGS84 degrees for t.in.era5 downloads (only used when precipitation=/pet= are not given); default derived from the region
t.drought computes gridded (per-pixel) drought indices at one
or more accumulation scales, over a chosen temporal aggregation level,
and registers each <output_prefix>_<index><scale>
result as its own space-time raster dataset (STRDS), e.g.
drought_spi3, drought_spei12.
If precipitation= (and, for SPEI, pet=) are not given, the
required STRDS are imported automatically via
t.in.era5 -- pulling exactly the date
range needed (the requested period, extended back far enough to cover
the largest accumulation scale, and the calibration/reference period if
it extends further back). t.in.era5's potential_evaporation
variable (ERA5 reanalysis PET) is used for SPEI's water balance term.
For each accumulation scale (see scales= below), precipitation
is summed over a rolling window of that many aggregation periods.
Within the calibration window (fit_start=/fit_end=), the
accumulated values for each "season group" (see AGGREGATION LEVELS)
are pooled per pixel and fit to a zero-inflated gamma distribution
using Thom's approximate MLE (WMO 2012), vectorized per pixel. Each
output period's accumulated value is then mapped through that
pixel/season-group's fitted CDF and transformed to a standard-normal
z-score -- the SPI value.
Identical procedure, but on the water balance (precipitation minus
PET) instead of raw precipitation, fit to a 3-parameter log-logistic
distribution via unbiased probability-weighted moments (the
ub-pwm estimator used by the R SPEI package's
parglo(), Vicente-Serrano et al. 2010) instead of gamma. This
is a closed-form L-moments-style fit, not full MLE -- matches the
reference implementation's default, but note it if you are
cross-checking against a different SPEI tool that defaults to MLE.
Because the log-logistic PWM fit uses order statistics, it requires a
pixel to have a value in every calibration sample for that
season group (no gaps) -- a season group with any missing period at a
pixel is left unfit (NaN) at that pixel.
aggregation=monthly (the default) reproduces the traditional
station-based SPI-1/-3/-6/-12/-24/-48 series when scales= is
left at its default 1,3,6,12,24,48 (accumulation scale =
number of calendar months). Season groups are calendar months (1-12),
so a month's fit uses only that same calendar month's history --
capturing seasonality the way standard SPI/SPEI does.
Other aggregation levels generalize the same procedure but the scale
number no longer means literal months:
weekly -- periods are ISO calendar weeks (Monday-Sunday);
season group is the ISO week number (1-53).
daily -- periods are single days; season group is (month,
day), with Feb 29 folded into the Feb 28 group. Needs many years of
history for a stable per-day fit -- 366 independent season groups is a
lot to calibrate.
yearly -- periods are calendar years; there is only one
season group (no intra-annual seasonality to capture).
custom -- periods are fixed custom_days=-day blocks
starting at the fetched range's start date; season group is the
block's position within an approximate year
(round(365.25 / custom_days) groups).
scales=1,3,6,12,24,48 with a non-monthly aggregation still
means "1, 3, 6, ... consecutive periods", e.g. with
aggregation=weekly a "scale 12" output is a 12-week
accumulation, not 12 months -- name it accordingly when interpreting
<prefix>_spi12 in that case.
fit_start=/fit_end= define the reference period the
gamma/log-logistic distributions are fit against, independent of the
output period start=/end=. If omitted they default to
start=/end=, which is fine for a quick test but not
recommended for real use: WMO guidance for SPI is >=30 years of
reference data, and the log-logistic PWM fit in particular is unstable
with few samples. A warning is printed for any (scale, season-group)
combination with fewer than 8 calibration samples.
t.drought automatically fetches history far enough back from
min(start, fit_start) to cover both the calibration period and
the largest requested accumulation scale's look-back window.
Standard monthly SPI/SPEI-1/3/6/12/24/48 over Iraq's Karkheh basin
region for 2020-2023, calibrated against 1991-2023, importing ERA5
data automatically:
The remaining EDO/GDO-family indices are recognized in indices=
but not yet implemented, since each needs a different external data
source rather than just t.in.era5:
cdi (Combined Drought Indicator) -- combines SPI, soil
moisture anomaly (SMA) and a vegetation stress indicator (fAPAR
anomaly); needs the GDO SMA and fAPAR anomaly layers from
drought.emergency.copernicus.eu/gdo.
lfi (Low Flow Index) -- streamflow-based; needs the JRC
European Low Flow Index dataset (GeoTIFF/NetCDF,
DOI:10.2905/JRC.B2SRQV0) from
data.jrc.ec.europa.eu.
Each of these needs a download/ingest path built and verified against
the actual portal (format, resolution, access terms) before it can be
wired into t.drought the way t.in.era5 is for SPI/SPEI.