genRain: Generate 100 years of simulated rainfall

Description Usage Arguments Value Author(s) References Examples

Description

Generate 100 years of simulated rainfall from the average monthly rainfall and the average number of rainy days.

Usage

1
genRain(rain, rainydays) 

Arguments

rain

numeric vector of 12 monthly values

rainydays

numeric vector of 12 monthly values

Value

A matrix with 365 rows (days) and 100 columns (years)

Author(s)

Robert J. Hijmans

References

Shu Geng, Frits W.T. Penning de Vries, Iwan Supit, 1986. A simple method for generating daily rainfall data, Agricultural and Forest Meteorology 36: 363-376. http://dx.doi.org/10.1016/0168-1923(86)90014-6.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
precip <- c(10, 20, 40, 60, 140, 110, 80, 40, 30, 25, 15, 5)
precdays <- round(sqrt(precip))
precdays

g <- genRain(precip, precdays)
g[1:15, 1:10]

# checking the outputs
m <- monthFromDate(daysOfYear(2001))
# average rainfall per month
round(rowMeans(aggregate(g, list(m), sum)))
# average number of wet days per month
round(rowMeans(aggregate(g>0, list(m), sum)))


Search within the weather package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.