ropensci / chirps

API Client for CHIRPS
https://docs.ropensci.org/chirps/
MIT License
30 stars 12 forks source link

Not possible to get data for only one or two days #32

Open adamhsparks opened 3 years ago

adamhsparks commented 3 years ago

This line checking the dates, https://github.com/ropensci/chirps/blob/7f60a8e6f9ddcf89f79179af4f5911a446e4a2ff/R/internal_functions.R#L303 works such that if I wanted to fetch data for 2015-01-15 - 2015-01-16 chirps will fail with the error message that the dates are out of sync with available data or that they are reversed (twisted).

adamhsparks commented 3 years ago

It also means you can't fetch data for just one day as the value is 0. Checking for negative values instead should work.

adamhsparks commented 3 years ago

@kauedesousa, I've implemented a fix. I'll write some tests to be sure that there aren't unintended side effects.

https://github.com/ropensci/chirps/commit/800ba7075c1e6212019d11658f0481e19713c364