# NOT RUN {
# Using local sources
data("chirp", package = "climatrends")
day <- as.Date("2013-10-28", format = "%Y-%m-%d")
rainfall(chirp,
day.one = day,
span = 11)
# }
# NOT RUN {
# Using NASA POWER
library("nasapower")
# random points within bbox(11, 12, 55, 58)
set.seed(123)
lonlat <- data.frame(lon = runif(3, 11, 12),
lat = runif(3, 55, 58))
# random dates within 2018-05-15 and 2018-05-20
set.seed(321)
dates <- as.integer(runif(3, 17666, 17670))
dates <- as.Date(dates, origin = "1970-01-01")
# calculate rainfall for the first 50 days after day.one
rainfall(lonlat,
day.one = dates,
span = 50)
# include the first 15 days before day.one (residual precipitation)
rainfall(lonlat,
day.one = dates,
span = 50,
days.before = 15)
# rainfall indices over a time series
rainfall(lonlat,
day.one = dates,
span = 50,
timeseries = TRUE,
intervals = 7)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab