gfcanalysis
gfcanalysis copied to clipboard
Sometimes download_tiles() fails because utils::download.file() reaches the 60s default timeout
This is an example of the default timeout (60s) being reached:
1 tiles to download/check.
Hansen_GFC-2023-v1.11_lossyear_20N_100E.tif exists but doesn't match remote - re-downloading file
trying URL 'http://commondatastorage.googleapis.com/earthenginepartners-hansen/GFC-2023-v1.11/Hansen_GFC-2023-v1.11_lossyear_20N_100E.tif'
Content type 'image/tiff' length 114693195 bytes (109.4 MB)
================================
downloaded 71.3 MB
Error in download.file(tile_url, local_path, mode = "wb") :
download from 'http://commondatastorage.googleapis.com/earthenginepartners-hansen/GFC-2023-v1.11/Hansen_GFC-2023-v1.11_lossyear_20N_100E.tif' failed
In addition: Warning messages:
1: In download.file(tile_url, local_path, mode = "wb") :
downloaded length 74808083 != reported length 114693195
2: In download.file(tile_url, local_path, mode = "wb") :
URL 'http://commondatastorage.googleapis.com/earthenginepartners-hansen/GFC-2023-v1.11/Hansen_GFC-2023-v1.11_lossyear_20N_100E.tif': Timeout of 60 seconds was reached
I will PR a fix to this by adding a timeout argument to download_tiles()