pdsi: Calculation of (sc)PDSI

Description Usage Arguments Details Value References Examples

View source: R/pdsi.R

Description

Calculates monthly scPDSI series from temperature and precipitation data. Uses binaries compiled from official University of Nebraska C++ Code.

Usage

1
pdsi(awc, lat, climate, start, end, mode = "both", verbose = TRUE)

Arguments

awc

Available soil water capacity (in mm)

lat

Latitude of the site (in decimal degrees)

climate

data.frame with monthly climate data consisting of 4 columns for year, month, temperature (deg C), and precipitation (mm)

start

Start year for PDSI calculation

end

End year for PDSI calculation

mode

one of c("both", "pdsi", "scpdsi")

verbose

should stderr/stdout be shown?

Details

This function transforms the input climate data into the necessary files for the PDSI binary executable and saves them to a temp directory. The binary is called and the resulting files of interest for PDSI and scPDSI are read in again and returned.

For details on the algorithm, see the comments in the C++ source file. For reference, the original source code (scpdsi-orig.cpp) is put in the toplevel installation directory of the package, you may find it using system.file(package = "pdsi"). For building the Linux binaries, a modified version of the original source code (scpdsi.cpp, string constants cast to (char *) for compatibility with modern g++, Windows-specific code commented out) is also distributed with the package in the same directory. To build the binary on Linux, use pdsi::build_linux_binary().

Value

For mode "both", a list of two data.frames, one holding the standard PDSI, one holding the scPDSI. For modes "pdsi" or "scpdsi" only the respective data.frame.

References

Methodology based on Research Paper No. 45; Meteorological Drought; by Wayne C. Palmer for the U.S. Weather Bureau, February 1965.

Examples

1
2
3
library(bootRes)
data(muc.clim)
pdsi(120, 50, muc.clim, 1960, 2000)

cszang/pdsi documentation built on May 14, 2019, 12:27 p.m.