environmentalinformatics-marburg / heavyRain

Download and pre-process (partly) satellite-based CHIRPS and TRMM rainfall data sets in R.
Other
12 stars 6 forks source link

getCHIRPS function not found #6

Closed khanzainub closed 4 years ago

khanzainub commented 4 years ago

I need to download CHIRPS data but don't know which package should I use for getCHRPS function in R and which code is needed to download this data?

I'm new in R. Someone, please help!

fdetsch commented 4 years ago

getCHIRPS() is in heavyRain. The package is not on CRAN, but can be installed from GitHub via the following command:

# install.packages("remotes")
remotes::install_github("environmentalinformatics-marburg/heavyRain")
library(heavyRain)

Everything else really depends on what you're after, i.e area of interest, desired spatial/temporal resolution, etc. A general workflow could look as follows:

## download data
gzs = getCHIRPS(
  "africa" # target area
  , tres = "monthly" # temporal resolution
  , begin = as.Date("1982-01-01"), end = as.Date("1983-12-31") # time period
  , dsn = tmpDir() # change for permanent storage
)

## extract layers
tfs = extractCHIRPS(
  gzs
  , dsn = tmpDir() # change for permanent storage
)

## import layers
rst = stack(tfs)
rst

All the analytical work that would follow afterwards is beyond the scope of this package, and requires the deployment of more sophisticated geospatial libraries.