
Compute simple precipitation indices over a time series
Source:R/precip_indices.R
precip_indices.RdA simple example of how to compute rainfall indices from the data
returned by get_chirps or get_imerg. For
analysis, use the climatrends package instead.
climatrends::rainfall() computes the same indices with tested
definitions and flexible periods per location, and climatrends also has
temperature, growing degree days, evapotranspiration and crop sensitive
indices. See the examples for how to pass CHIRPS data to it.
Arguments
- object
an object of class
chirpsas provided byget_chirps- timeseries
logical,
FALSEfor a single point time series observation orTRUEfor a time series based on intervals- intervals
integer no lower than 5, for the days intervals when timeseries =
TRUE
Value
A data frame with precipitation indices:
- MLDS
maximum length of consecutive dry day, rain < 1 mm (days)
- MLWS
maximum length of consecutive wet days, rain >= 1 mm (days)
- R10mm
number of heavy precipitation days 10 >= rain < 20 mm (days)
- R20mm
number of very heavy precipitation days rain >= 20 (days)
- Rx1day
maximum 1-day precipitation (mm)
- Rx5day
maximum 5-day precipitation (mm)
- R95p
total precipitation when rain > 95th percentile (mm), with the percentile taken over all days in the period, dry days included
- R99p
total precipitation when rain > 99th percentile (mm), with the percentile taken over all days in the period, dry days included
- Rtotal
total precipitation (mm) in wet days, rain >= 1 (mm)
- SDII
simple daily intensity index, total precipitation in wet days divided by the number of wet days (mm/days)
References
Aguilar E., et al. (2005). Journal of Geophysical Research, 110(D23), D23107.
de Sousa K., van Etten J., Neby M., Solberg S. Ø. (2023). Climate variability indices for ecological and crop models in R: the climatrends package. Journal of Open Source Software, 8(85), 4405. doi:10.21105/joss.04405
Kehel Z., et al. (2016). In: Applied Mathematics and Omics to Assess Crop Genetic Resources for Climate Change Adaptive Traits (eds Bari A., Damania A. B., Mackay M., Dayanandan S.), pp. 151-174. CRC Press.
Examples
if (FALSE) { # interactive()
lonlat = data.frame(lon = c(-55.0281,-54.9857),
lat = c(-2.8094, -2.8756))
dates = c("2017-12-15", "2017-12-31")
dt = get_chirps(lonlat, dates)
# take the indices for the entire period
precip_indices(dt, timeseries = FALSE)
# take the indices for periods of 7 days
precip_indices(dt, timeseries = TRUE, intervals = 7)
# recommended, the same data in climatrends
if (requireNamespace("climatrends", quietly = TRUE)) {
rain = get_chirps(lonlat, dates, as.matrix = TRUE)
climatrends::rainfall(rain, day.one = dates[1], span = ncol(rain))
}
}