[R-sig-Geo] writeRaster give error "no slot of name "file" for this object..."

Herry Alexander.Herr at csiro.au
Wed Jul 16 06:43:03 CEST 2014


Hello,

I have a similar problem, but using the latest versions of R and raster:

"luse1"<-function(x){ 
  x[x >=1 & x<=199]<-100        #Conservation land use
  x[x >=200 & x<=299]<-200        #Native Vegetation extensive use
  x[x >=210 & x<=210]<-210        #Grazing native vegetation
  x[x >=221 & x<=222]<-220        #Production forestry
  x[x >=300 & x<=399]<-300        #Dryland agriculture and plantations
  x[x >=310 & x<=314]<-310        #Plantations
  x[x >=321 & x<=325]<-320        #Grazing modified pastures
  x[x >=331 & x<=338]<-330        #Cropping
  x[x >=341 & x<=349]<-340        #Horticulture
  x[x >=400 & x<=499]<-400        #Irrigated agriculture and plantations
  x[x >=411 & x<=414]<-410        #Irrigated plantation
  x[x >=421 & x<=224]<-420        #Irrigated pasture
  x[x >=431 & x<=439]<-430        #Irrigated cropping
  x[x >=441 & x<=449]<-440        #Irrigated horticulture
  x[x >=451 & x<=455]<-450        #Irrigated seasonal horticulture
  x[x >=500 & x<=599]<-500        #Intensive uses
  x[x >=600 & x<=699]<-600        #Water
  x[x >=611 & x<=614]<-610        #Lake
  x[x >=621 & x<=623]<-620        #Reservoir or dam
  x[x >=631 & x<=633]<-630        #River
  x[x >=641 & x<=643]<-640        #Channel/aquaduct
  x[x >=651 & x<=654]<-650        #Marsh/wetland
  x[x >=661 & x<=663]<-660        #Estuary/coast waters
  return(x[])
}



> writeStart(s, filename = 'landuse4BA.grd', overwrite =TRUE)
class       : RasterLayer 
dimensions  : 76740, 80200, 6154548000  (nrow, ncol, ncell)
resolution  : 50, 50  (x, y)
extent      : -1888000, 2122000, -4847000, -1010000  (xmin, xmax, ymin,
ymax)
coord. ref. : +proj=aea +lat_1=-18 +lat_2=-36 +lat_0=0 +lon_0=132 +x_0=0
+y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs 
data source :
\\wron/Project/BA/BA_ecology/Ozdata/landuse/clum_50m0314m/R/landuse4BA.grd 
names       : clum50m0314 

> for (i in 1:nrow(rs)) {
+   print(paste(i, "of", nrow(rs),";", round(i/nrow(rs)*100,1), "%
complete"))
+   v <- getValues(rs, row=i, nrows=1)
+   z<-luse1(v) #assign landuse value
+   s <- writeValues(s, z, i)
+ }
[1] "1 of 76740 ; 0 % complete"
Error in is(object) : 
  no slot of name "transient" for this object of class ".RasterFile"


> sessionInfo()
R version 3.1.1 (2014-07-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=English_Australia.1252  LC_CTYPE=English_Australia.1252   
LC_MONETARY=English_Australia.1252 LC_NUMERIC=C                      
LC_TIME=English_Australia.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] rgdal_0.8-16  raster_2.2-31 sp_1.0-15     spatial_7.3-8

loaded via a namespace (and not attached):
[1] grid_3.1.1      lattice_0.20-29


Any suggestions?
Thanks and cheers
Herry



--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/writeRaster-give-error-no-slot-of-name-file-for-this-object-tp6450479p7586744.html
Sent from the R-sig-geo mailing list archive at Nabble.com.



More information about the R-sig-Geo mailing list