Learn R Programming

rnoaa (version 1.4.0)

arc2: Arc2 - Africa Rainfall Climatology version 2

Description

Arc2 - Africa Rainfall Climatology version 2

Usage

arc2(date, box = NULL, ...)

Value

a list of tibbles with columns:

  • date: date (YYYY-MM-DD)

  • lon: longitude

  • lat: latitude

  • precip: precipitation (mm)

Arguments

date

(character/date) one or more dates of the form YYYY-MM-DD

box

(numeric) vector of length 4, of the form xmin, ymin, xmax, ymax. optional. If not given, no spatial filtering is done. If given, we use dplyr::filter() on a combined set of all dates, then split the output into tibbles by date

...

curl options passed on to crul::verb-GET

box parameter

The box parameter filters the arc2 data to a bounding box you supply. The function that does the cropping to the bounding box is dplyr::filter. You can do any filtering you want on your own if you do not supply box and then use whatever tools you want to filter the data by lat/lon, date, precip values.

References

docs: https://ftp.cpc.ncep.noaa.gov/fews/fewsdata/africa/arc2/ARC2_readme.txt

Examples

Run this code
if (FALSE) {
x = arc2(date = "1983-01-01")
arc2(date = "2017-02-14")

# many dates
arc2(date = c("2019-05-27", "2019-05-28"))
arc2(seq(as.Date("2019-04-21"), by = "day", length.out = 5))
## combine outputs 
x <- arc2(seq(as.Date("2019-05-20"), as.Date("2019-05-25"), "days"))
dplyr::bind_rows(x)

# bounding box filter
box <- c(xmin = 9, ymin = 4, xmax = 10, ymax = 5)
arc2(date = "2017-02-14", box = box)
arc2(date = c("2019-05-27", "2019-05-28"), box = box)
arc2(seq(as.Date("2019-05-20"), as.Date("2019-05-25"), "days"), box = box)
}

Run the code above in your browser using DataLab