在 R 中加载 ESRI ArcGrid 导出文件 (e00) 时遇到问题
trouble loading an ESRI ArcGrid export file (e00) in R
我正在尝试将 ESRI ArcGrid 导出文件加载到 R 中。该文件位于 - ftp://ftp.epa.gov/castnet/tdep/grids/n_tw/n_tw-2013.zip. The documentation for this file states, "Gridded data of the above variables are available in compressed ESRI ArcGRID export files" and not much else. Link to documentation here。我的主要问题是这是一个 e00
文件,Arc 的旧输出格式。
正常加载光栅(如果这不是 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
文件转换为更有用的 Arc/Info 二进制覆盖。为此:
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
,但是,两者都是空的。我不确定这里出了什么问题。任何关于如何将其作为栅格加载到 R 中以便我可以将数据提取到我的特定 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
使用 library(rgdal)
中的函数 readGDAL
在您的示例中应该有效:
n_tw_2013 <- readGDAL("path/to/the/file/n_tw-2013.e00")
我使用 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
我正在尝试将 ESRI ArcGrid 导出文件加载到 R 中。该文件位于 - ftp://ftp.epa.gov/castnet/tdep/grids/n_tw/n_tw-2013.zip. The documentation for this file states, "Gridded data of the above variables are available in compressed ESRI ArcGRID export files" and not much else. Link to documentation here。我的主要问题是这是一个 e00
文件,Arc 的旧输出格式。
正常加载光栅(如果这不是 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
文件转换为更有用的 Arc/Info 二进制覆盖。为此:
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
,但是,两者都是空的。我不确定这里出了什么问题。任何关于如何将其作为栅格加载到 R 中以便我可以将数据提取到我的特定 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
使用 library(rgdal)
readGDAL
在您的示例中应该有效:
n_tw_2013 <- readGDAL("path/to/the/file/n_tw-2013.e00")
我使用 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