Sunday, January 22, 2017

National Drought Mitigation Center

Program to Calculate Standardized Precipitation Index

To run the SPI_SL_6.exe file, right-click on it and save the file. Then execute (double click) the program; a dialogue box will pop up. Enter the number of SPI monthly intervals (up to six at one time) you wish to run (i.e. 1-, 3-, 4-, 6-, 12-month SPI) and enter the input and output file names. You can include one header line (like the station name) within the data input file. This is a little different from the method described in the alternative method file.

All input files must follow 3-column format: Year, Month and Monthly Precipitation Value. The precipitation total must NOT include decimals and can be in either inches or mm. Pay attention to column spacing and missing data issues. A zero will work; a missing data flag or -9999 will not.

The program is already compiled and all libraries are included (it was compiled in C++ for PC) so all you have to do is run the SPI_SL_6.exe file and follow the instructions on the pop up screen.

KEEP the header in your file (see ValeFormosaPortugalppt.cor file in the sample file zip to the right). Also, rename your input (precipitation file) files so that they have a .cor (ex, lincoln.cor) extension.

Name the output file anything you wish with a .dat (or .txt or .spi etc.) extension. (You may have to look in the code to see if it wants the files named in this way.) Save the files as MS-DOS ascii text files; results can be viewed using Microsoft Notepad or Wordpad. This output data can be plotted, graphed or mapped in any spreadsheet or GIS software.

For further documentation or to download the original UNIX version of the SPI program, please see This site includes some user instructions as well as several additional programs. In the UNIX version, a particularly useful program is rundr_m, which allows you to study a site’s or region’s drought history, including an analysis of frequency and duration for a magnitude ranking of sorts. The main program is runspi, which actually generates the SPI files from monthly precipitation totals files (.cor files).

Again, you only need monthly precipitation values (in inches or mm without decimals) to run these programs, but you must have at least 30 consecutive years without missing monthly data, and more than 60 years is recommended.

Additional documentation on the SPI is available from the NDMC.







Sample Files - includes wymo.cor, ValeFormosaSPI.dat, and ValeFormosaPortugalppt.cor

The National Drought Mitigation Center | 3310 Holdrege Street | P.O. Box 830988 | Lincoln, NE 68583–0988
phone: (402) 472–6707 | fax: (402) 472–2946 | Contact Us | Web Policy

University of Nebraska-Lincoln
Copyright 2017 National Drought Mitigation Center