Get daily precipitation data from the "Climate Hazards Group InfraRed Precipitation with Station Data" via ClimateSERV API client. ClimateSERV works with geojson of type 'Polygon'. The input object is then transformed into polygons with a small buffer area around the point.

get_chirps(object, dates, operation = 5, ...)

# S3 method for default
get_chirps(object, dates, operation = 5, ...)

# S3 method for sf
get_chirps(object, dates, operation = 5, as.sf = FALSE, ...)

# S3 method for geojson
get_chirps(object, dates, operation = 5, as.geojson = FALSE, ...)

Arguments

object

input, an object of class data.frame (or any other object that can be coerced to data.frame), geojson or sf

dates

a character of start and end dates in that order in the format "YYYY-MM-DD"

operation

optional, an integer that represents which type of statistical operation to perform on the dataset

...

further arguments passed to sf methods See details

as.sf

logical, returns an object of class sf

as.geojson

logical, returns an object of class geojson

Value

A data frame of CHIRPS data:

id

the index for the rows in object

dates

the dates from which CHIRPS was requested

lon

the longitude as provided in object

lat

the latitude as provided in object

chirps

the CHIRPS value in mm

Details

operation: supported operations are:

operationvalue
max=0
min=1
median=2
sum=4
average=5 (default value)

dist: numeric, buffer distance for each object coordinate

nQuadSegs: integer, number of segments per buffer quadrant

Note

get_chirps may return some warning messages given by sf, please look sf documentation for possible issues.

References

Funk C. et al. (2015). Scientific Data, 2, 150066.
https://doi.org/10.1038/sdata.2015.66

ClimateSERV https://climateserv.servirglobal.net

Examples

# \donttest{ 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)
#> Getting your request...
dt
#> id lon lat date chirps #> <int> <dbl> <dbl> <date> <dbl> #> 1: 1 -55.03 -2.81 2017-12-15 0.00 #> 2: 1 -55.03 -2.81 2017-12-16 0.00 #> 3: 1 -55.03 -2.81 2017-12-17 13.69 #> 4: 1 -55.03 -2.81 2017-12-18 13.69 #> 5: 1 -55.03 -2.81 2017-12-19 0.00 #> --- #> 30: 2 -54.99 -2.88 2017-12-27 37.54 #> 31: 2 -54.99 -2.88 2017-12-28 18.77 #> 32: 2 -54.99 -2.88 2017-12-29 0.00 #> 33: 2 -54.99 -2.88 2017-12-30 9.39 #> 34: 2 -54.99 -2.88 2017-12-31 9.39
# }