chirps icon indicating copy to clipboard operation
chirps copied to clipboard

get_chirps using a SpatRaster?

Open adamhsparks opened this issue 2 years ago • 2 comments

I'm working on writing tests to improve the test coverage for the package (and hopefully stop the automated e-mails that the tests failed).

Right now I'm working on get_chirps() for the SpatRaster method but I'm getting an error.

 r <- rast(system.file("ex/elev.tif", package = "terra"))
 x_raster <- get_chirps(r, dates, server = "CHC", as.raster = TRUE)

Results in an error.

Error in `[.data.frame`(lonlat, , 2) : undefined columns selected

Am I just using the function incorrectly?

adamhsparks avatar Apr 20 '22 05:04 adamhsparks

There is an issue in the S3 methods, for some reason it does not go the get_chirps.SpatExtent or get_chirps.SpatRaster or get_chirps.SpatVector and goes to the default method which gives this error. I tried to fix without success and wrote a turn around solution that you can find here https://github.com/ropensci/chirps/commit/f6da1c664049d9f598d1823805c05b7e14823a3a. Is not an elegant way to solve, but is the one I found considering our limited time. What do you think?

kauedesousa avatar Jan 06 '23 11:01 kauedesousa

It happens also to me. Probably can you remove this possibility from the package? Thank you

ecor avatar Feb 20 '24 10:02 ecor