SWAP

Luo_Suppe2026-08-15

gma.climet.index.SWAP

function SWAP(pre, a = 0.9, n = 44, axis = None, scale = 1, periodicity = 365, distribution = "Gamma", fit_method = "MLE", calibration = None):

Calculate the Standardized Weighted Average of Precipitation.

Parameters:

pre: array.

Precipitation (mm).

Optional:

a = float. Default 0.9.

The parameter of weight decay over time.

N = int. Default 44.

Days of Impact in the Early Stage.

axis = int. Default None.

Calculation axis. If not set (None), multidimensional data will be expanded to 1 dimension for calculation.

scale = int. Default 1.

Time scale. For example: 1, 3 or others.

periodicity = int. Default 365.

periodicity of data. For example: the monthly scale can have a period of 12.

distribution = str. Default 'Gamma'.

Distribution type to be used for the internal fitting/transform computation.

Supported distributions include: 'Gamma', 'LogLogistic', 'Pearson3'.

fit_method = str. Default 'MLE'.

Fitting methods for distribution parameters.

Supported method include: 'MLE': Maximum Likelihood Estimation, 'LMoment': L-Moment Estimation(PWD), 'LMoment2': L-Moment Estimation.

calibration = list||slice||None. Default None.

Fit the calibration interval of distribution parameter data, Based on the periodicity.

Default(None) using all data. For example: Select the data from 1-5 periodicity to fit parameters: calibration = [0, 5] Then apply the parameter fitting results to all data.

*Note: scale||periodicity||Calibrationarebasedoncalculatedaxis!.

Returns:

Type: array.

References.

J2009-Determining the start, duration, and strength of flood and drought with daily precipitation: Rational.

J2014-The day-to-day monitoring of the 2011 severe drought in China..

GB/T 20481��201�� Grades of meteorological drought..


Last Updated 8/15/2026, 8:42:21 AM