Package 'spi'

Title: Compute SPI Index
Description: Compute the Standardized Precipitation Index (SPI) using R. Compatibility updates by Renova.
Authors: Josemir Neves [aut, cre]
Maintainer: Josemir Neves <[email protected]>
License: GPL-2
Version: 1.1.9001
Built: 2026-11-16 22:18:59 UTC
Source: https://github.com/renova-r/spi

Help Index


Standardized Precipitation Index (SPI)

Description

The SPI function computes the SPI index (McKee et al., 1993) from a predefined time scale (1 month, 3 months, 24 months, etc.) to a period choosen by users.

Usage

spi(nargs, filename, id, fd, title, output, txlab, tylab)

Arguments

nargs

number of arguments (minimum = 3)

filename

name of datafile

The datafile in ASCII format must have the following layout:

Months 2005 2006 2007 2008 2009 2010
Jan 28.1 5.8 22.9 64.2 70.1 85.9
Feb 41.4 85.1 149.2 31.0 142.1 36.9
Mar 153.2 145.9 101.6 308.8 171.8 57.5
Apr 57.0 212.4 170.3 244.5 278.9 132.9
May 154.9 119.9 57.8 128.8 212.7 55.6
jun 158.6 81.3 160.8 94.0 115.3 63.3
Jul 22.6 27.2 29.4 80.9 82.7 30.9
id

initial data

fd

final data

title

data title

output

output type ( 1 - graph, 2 - results matrix )

txlab

the X axis title

tylab

the Y axis title

Details

Positive SPI values indicate greater than median precipitation and negative values indicate less than median precipitation. Drought periods are represented by relatively high negative deviations. Normally, the 'drought' part of the SPI range is arbitrary split into moderately dry (-1.0 > SPI > -1.49), severely dry (-1.5 > SPI > -1.99) and extremely dry conditions (SPI < -2.0). A drought event starts when SPI value reaches -1.0 and ends when SPI becomes positive again (McKee et al., 1993).

This function use the SPI range defined by National Climatic Data Center (NCDC):

exceptionally moist: SPI >= 2.0
extremely moist: 1.60 <= SPI < 1.99
very moist: 1.30 <= SPI < 1.59
moderately moist: 0.80 <= SPI < 1.29
abnormally moist: 0.51 <= SPI < 0.79
near normal: -0.50 <= SPI <= 0.50
abnormally dry: -0.79 <= SPI < -0.51
moderately dry: -1.29 <= SPI < -0.80
severely dry: -1.59 <= SPI < -1.30
extremely dry: -1.99 <= SPI < -1.60
exceptionally dry: SPI <= -2.0

Value

Returns a data matrix or a graphic with SPI values.

Author(s)

Josemir A Neves ([email protected]/[email protected])

References

McKee, T.B., Doesken, N.J., Kleist, J., 1993. The relationship of drought frequency and duration to time scales. In: Preprints, Eighth Conference on Applied Climatology, January 17 e 22, Anaheim, California, pp. 179 e 184.

Examples

##load data

data(spi_data) 

##write to file

write.table(spi_data,file="spi.txt",quote=FALSE,row.names=TRUE)	  

## Standard format with the output in the text format

spi(3,"spi.txt",1963,2010)

## A full output in graphical format

spi(7,"spi.txt",1963,2010,"Standardized Precipitation Index - Rio Grande do Norte State",1,"years","months")

SPI of the rainy season in the Rio Grande do Norte

Description

This data set present the Standardized Precipitation Index (SPI) of the rainy season in the Rio Grande do Norte State - Brazil.

Usage

spi_data

Format

A matrix containing 336 observations.

Source

Empresa de Pesquisa Agropecuaria do Rio Grande do Norte - EMPARN

References

EMPARN. Rainfall database of the Rio Grande do Norte. URL http://www.emparn.rn.gov.br