我正在尝试将esri arcgrid导出文件加载到R。文件位于-ftp://ftp.epa.gov/castnet/castnet/tdep/grids/grids/n_tw/n_tw/n_tw--2013. zip。该文件的文档指出:"上述变量的网格数据可在压缩的ESRI ARCGRID导出文件中获得",而没有其他内容。在此处链接到文档。我的主要问题是,这是一个e00
文件,一种旧输出格式。
正常加载栅格的最直接方法(如果不是e00
文件)是:
require(raster)
require(rgdal)
test <- raster('/path/to/n_tw-2013.e00')
但是,您将收到错误:n_tw-2013.e00 not recognised as a supported file format.
。
RArcInfo
软件包声称能够将.e00
文件转换为更有用的弧/信息二进制覆盖范围。为此:
require(RArcInfo)
#first argument is the path to the e00 file, and the second argument is the new directory to create
e00toavc('/path/to/n_tw-2013.e00','/path/to/test1')
运行此命令时,它会打印NULL
,并创建两个目录test1
和info
,但是,两个目录都是空的。我不确定这里怎么了。关于如何将其加载到raster中的任何建议,以便我可以将数据提取到我的特定lat/long中。
sessionInfo
的输出在此处粘贴:
> sessionInfo()
R version 3.2.2 (2015-08-14)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: CentOS release 6.7 (Final)
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods
[7] base
other attached packages:
[1] rgdal_1.2-5 raster_2.5-8 sp_1.2-4
loaded via a namespace (and not attached):
[1] tools_3.2.2 Rcpp_0.12.3 grid_3.2.2 lattice_0.20-33
我使用 rgdal 1.2-3
和 raster 2.5-8
在文件中阅读没有问题:
require(raster)
require(rgdal)
test <- raster('n_tw-2013.e00')
test
class : RasterLayer
dimensions : 775, 1440, 1116000 (nrow, ncol, ncell)
resolution : 4134.354, 4134.354 (x, y)
extent : -2950369, 3003101, 115686.8, 3319811 (xmin, xmax, ymin, ymax)
coord. ref. : +proj=aea +lat_1=0 +lat_2=29.5 +lat_0=45.5 +lon_0=0 +x_0=0 +y_0=-96 +ellps=WGS84 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs
data source : /Users/Martin/Desktop/n_tw-2013.e00
names : n_tw.2013
values : 0.8068619, 70.83445 (min, max)
R version 3.3.1 (2016-06-21)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.12.2 (Sierra)
locale:
[1] de_DE.UTF-8/de_DE.UTF-8/de_DE.UTF-8/C/de_DE.UTF-8/de_DE.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] raster_2.5-8 sp_1.2-3
loaded via a namespace (and not attached):
[1] Rcpp_0.12.7 plotly_4.5.2 magrittr_1.5 munsell_0.4.3 colorspace_1.2-7
[6] viridisLite_0.1.3 lattice_0.20-34 R6_2.2.0 httr_1.2.1 plyr_1.8.4
[11] dplyr_0.5.0 tools_3.3.1 rgdal_1.2-3 grid_3.3.1 gtable_0.2.0
[16] DBI_0.5-1 htmltools_0.3.5 lazyeval_0.2.0 assertthat_0.1 digest_0.6.10
[21] tibble_1.2 purrr_0.2.2 ggplot2_2.2.0 tidyr_0.6.0 base64enc_0.1-3
[26] htmlwidgets_0.8 scales_0.4.1 jsonlite_1.1
使用library(rgdal)
readGDAL
在您的示例中应有效:
n_tw_2013 <- readGDAL("path/to/the/file/n_tw-2013.e00")