[英]Decompress .tif.gz file using R
I got data from Chirps in tif.gz format, I tried R.utils::gunzip
to get the maps but I got an error.我从 Chirps 获得了 tif.gz 格式的数据,我尝试
R.utils::gunzip
来获取地图,但出现错误。
file<-"./chirps-v2.0.1981.01.01.tif.gz"
R.utils::gunzip(file,remove=F)
Error:错误:
Error in readBin(inn, what = raw(0L), size = 1L, n = BFR.SIZE) :
error reading from the connection
In addition: Warning message:
In readBin(inn, what = raw(0L), size = 1L, n = BFR.SIZE) :
invalid or incomplete compressed data
If there is a better alternative to unzip these files it will be a great solution.如果有更好的选择来解压缩这些文件,那将是一个很好的解决方案。 Thank you in advance.
先感谢您。
I tried these but it didn't work R: read GeoTiff from gz file with a connection and raster package Decompress gz file using R我尝试了这些,但没有用
The following works for me:以下对我有用:
url <- paste0("https://data.chc.ucsb.edu/products/CHIRPS-2.0/",
"global_daily/tifs/p05/1981/chirps-v2.0.1981.01.01.tif.gz")
download.file(url, "chirps-v2.0.1981.01.01.tif.gz")
R.utils::gunzip("chirps-v2.0.1981.01.01.tif.gz", remove = FALSE)
File: chirps-v2.0.1981.01.01.tif文件:啁啾-v2.0.1981.01.01.tif
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.