1

I am trying to load an ESRI ArcGrid export file into R. The file is located at- 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. My major problem is that this is an e00 file, an old output format of Arc.

The most straightforward way to load a raster normally (if this wasn't an e00 file) would be:

require(raster)
require(rgdal)    
test <- raster('/path/to/n_tw-2013.e00')

However, you will receive the error: n_tw-2013.e00 not recognised as a supported file format..

The RArcInfo package claims to be able to convert .e00 files into more useful Arc/Info binary coverage. To do this:

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')

When I run this command it prints NULL, and creates two directories, test1, and info, however, both are empty. I'm not sure whats going wrong here. Any advice on how to get this loaded into R as a raster so I can extract data to my specific lat/long would be greatly appreciated.

Output of sessionInfo pasted here:

> 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
colin
  • 2,606
  • 4
  • 27
  • 57

2 Answers2

1

Use the function readGDAL from library(rgdal)

In your example should work:

n_tw_2013 <- readGDAL("path/to/the/file/n_tw-2013.e00")
G. Cocca
  • 2,456
  • 1
  • 12
  • 13
1

I have no problem reading in the file using rgdal 1.2-3 and 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   
Martin Schmelzer
  • 23,283
  • 6
  • 73
  • 98
  • strange, I just updated both `raster` and `rgdal`, but this still does not work for me... – colin Dec 24 '16 at 22:39
  • 1
    I added my sessionInfo. Maybe restart R so you have a clean environment. – Martin Schmelzer Dec 24 '16 at 22:47
  • Thanks for this. You prompted me to test this on my local machine where it did work with just the call to `raster`. No luck updating my packages or restarting R, but this definitely pushed me further. Will award the bounty as soon as I can. – colin Dec 24 '16 at 23:05
  • I am still interested in why it does not work. What OS are you using on the machine that does not like this snippet? – Martin Schmelzer Dec 24 '16 at 23:06
  • sessionInfo pasted into thread. – colin Dec 24 '16 at 23:10
  • Could you try `raster('n_tw-2013.e00', native = T)` on Debian? And maybe rename the file so it does not contain hyphen or an underscore. Just to be sure :) – Martin Schmelzer Dec 25 '16 at 00:05
  • same problem, `not recognised as a supported file format. Error in .rasterObjectFromFile(x, band = band, objecttype = "RasterLayer", : Cannot create a RasterLayer object from this file.` – colin Dec 25 '16 at 00:08
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/131428/discussion-between-martin-schmelzer-and-colin). – Martin Schmelzer Dec 25 '16 at 00:11