Description Usage Arguments Value Author(s) References Examples
Generate 100 years of simulated rainfall from the average monthly rainfall and the average number of rainy days.
1 | genRain(rain, rainydays)
|
rain |
numeric vector of 12 monthly values |
rainydays |
numeric vector of 12 monthly values |
A matrix with 365 rows (days) and 100 columns (years)
Robert J. Hijmans
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.
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)))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.