Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CHC data not available on specific date #41

Open
samyadelara opened this issue Jan 19, 2022 · 5 comments
Open

CHC data not available on specific date #41

samyadelara opened this issue Jan 19, 2022 · 5 comments

Comments

@samyadelara
Copy link

Hello dear ropensci/chirps team!
I am facing an issue with a specific date when downloading CHIRPS data from CHC. The issue seems to be related to 2018-04-01.
Using the code presented below, I've been able to download data from 2010 up to march 2018. Also, I tested staring with 2018-04-02 on, and the data was retrieved. I also tried from ClimateSERV, with no sucess...

Do you have any suggestions or solution here?
Thank you in advance!

mt <-readOGR(file) \n
area <- st_bbox(mt)
area <- as.vector(area)
area <- terra::ext(area)

dates <- c("2018-04-01", "2018-04-10")
rain_data <- get_chirps(area, dates, server = "CHC")

Error: [rast] file does not exist: /vsicurl/https://data.chc.ucsb.edu/products/CHIRPS-2.0/global_daily/cogs/p05/2018/chirps-v2.0.2018.04.01.cog
In addition: Warning message:
`/vsicurl/https://data.chc.ucsb.edu/products/CHIRPS-2.0/global_daily/cogs/p05/2018/chirps-v2.0.2018.04.01.cog' not recognized as a supported file format. (GDAL error 4) 
@kauedesousa
Copy link
Member

hi @samyadelara @adamhsparks I checked the CHC file base and the dates are there https://data.chc.ucsb.edu/products/CHIRPS-2.0/global_daily/cogs/p05/2018/

Also I tried to run the example (with the Tapajos data) and it worked well. @samyadelara Could you try again? And if the problem persists, could you try to send a reproducible example where I can test the issue?

library(terra)
library(sf)
library(chirps)

data("tapajos")

area <- st_bbox(tapajos)

area <- as.vector(area)

area <- ext(area)

datas <- c("2018-04-01", "2018-04-10")

rain <- get_chirps(area, datas, server = "CHC")

@bocinsky
Copy link

Hi all. Users have been reporting the same for the ropensci/FedData package (see [ropensci/FedData/issues/88]), and I think it is a GDAL issue. GDAL 2 seems to struggle with using vsicurl to get COGs; I've had to ask users to upgrade to GDAL3.

Testing with your data:

With GDAL 2.4.2 (running on Ubuntu 20.04 from rocker/r-ver):

# gdalinfo /vsicurl/https://data.chc.ucsb.edu/products/CHIRPS-2.0/global_daily/cogs/p05/2018/chirps-v2.0.2018.04.01.cog
ERROR 4: /vsicurl/https://data.chc.ucsb.edu/products/CHIRPS-2.0/global_daily/cogs/p05/2018/chirps-v2.0.2018.04.01.cog: No such file or directory
gdalinfo failed - unable to open '/vsicurl/https://data.chc.ucsb.edu/products/CHIRPS-2.0/global_daily/cogs/p05/2018/chirps-v2.0.2018.04.01.cog'

With GDAL 3.0.5 (on same Ubuntu image):

# gdalinfo /vsicurl/https://data.chc.ucsb.edu/products/CHIRPS-2.0/global_daily/cogs/p05/2018/chirps-v2.0.2018.04.01.cog
Driver: GTiff/GeoTIFF
Files: /vsicurl/https://data.chc.ucsb.edu/products/CHIRPS-2.0/global_daily/cogs/p05/2018/chirps-v2.0.2018.04.01.cog
Size is 7200, 2000
[...]

Hope this helps!

@diazrenata
Copy link

A collaborator of mine is getting a similar error when trying to download relative humidity and precip data on a Mac using GDAL 3.4.2:

Error: [rast] file does not exist: /vsicurl/https://data.chc.ucsb.edu/products/CHIRTSdaily/v1.0/global_tifs_p05/RHum/2015/RH.2015.09.20.tif
In addition: Warning message:
`/vsicurl/https://data.chc.ucsb.edu/products/CHIRTSdaily/v1.0/global_tifs_p05/RHum/2015/RH.2015.09.20.tif' not recognized as a supported file format. (GDAL error 4) 

We are confused, because it seems to happen idiosyncratically. The precip data was failing last week, but now works. The relative humidity data continue to fail, but work fine on my machine. Do you have any insights into what might be happening?

@bocinsky
Copy link

Hi there. I just tried this and it worked for me:

terra::gdal()
#> [1] "3.5.3"
terra::rast("/vsicurl/https://data.chc.ucsb.edu/products/CHIRTSdaily/v1.0/global_tifs_p05/RHum/2015/RH.2015.09.20.tif")
#> class       : SpatRaster 
#> dimensions  : 2600, 7200, 1  (nrow, ncol, nlyr)
#> resolution  : 0.05, 0.05  (x, y)
#> extent      : -180, 180, -60, 70  (xmin, xmax, ymin, ymax)
#> coord. ref. : lon/lat WGS 84 (EPSG:4326) 
#> source      : RH.2015.09.20.tif 
#> name        : RH.2015.09.20

Created on 2024-05-13 with reprex v2.1.0

Can you include the output of terra::gdal()? Just want to confirm the version that {terra} is seeing.

@diazrenata
Copy link

Thanks for investigating! We got the GDAL version 3.4.2 from terra::gdal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants