An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20091120/213fb028/attachment.pl>
Error, exporting ascii grid generated by DTM grid
2 messages · Tobin Cara, Robert J. Hijmans
Shouldn't this: write.asciigrid(data_int_ked[1], name1) be: write.asciigrid(data_int_ked, name1) I think you are writing a single cell, which in this case could be interpreted as rectangular (if it covers the full grid)
On Fri, Nov 20, 2009 at 6:06 AM, Tobin Cara <cara.tobin at epfl.ch> wrote:
Hello, I am receiving a bizarre error recently: Erreur dans write.asciigrid(data_int_ked[1], name1) : ?Asciigrid does not support grids with non-square cells I do not understand this as I am putting interpolated data back into the cells of an ascii DTM grid with square cells. Information on the DTM and the file I am trying to write is below: Thank you in advance for your help, Cara
# Bring in GIS elevation
elev <- read.asciigrid("val200dtm.asc", as.image=FALSE, plot.image=TRUE)
elev <- as.data.frame(elev)
names(elev) <- c("Z","X","Y")
elev.x <- elev$X
elev.y <- elev$Y
elev.z <- elev$Z
coordinates(elev) <- ~X+Y
gridded(elev) = TRUE
fullgrid(elev) = TRUE
str(elev)
Formal class 'SpatialGridDataFrame' [package "sp"] with 6 slots
?..@ data ? ? ? :'data.frame': 278388 obs. of ?1 variable:
?.. ..$ Z: num [1:278388] NA NA NA NA NA NA NA NA NA NA ...
?..@ grid ? ? ? :Formal class 'GridTopology' [package "sp"] with 3 slots
?.. .. ..@ cellcentre.offset: Named num [1:2] 549720 78673
?.. .. .. ..- attr(*, "names")= chr [1:2] "X" "Y"
?.. .. ..@ cellsize ? ? ? ? : Named num [1:2] 200 200
?.. .. .. ..- attr(*, "names")= chr [1:2] "X" "Y"
?.. .. ..@ cells.dim ? ? ? ?: Named int [1:2] 627 444
?.. .. .. ..- attr(*, "names")= chr [1:2] "X" "Y"
?..@ grid.index : int(0)
?..@ coords ? ? : num [1:2, 1:2] 549720 674920 78673 167273
?.. ..- attr(*, "dimnames")=List of 2
?.. .. ..$ : NULL
?.. .. ..$ : chr [1:2] "X" "Y"
?..@ bbox ? ? ? : num [1:2, 1:2] 549620 78573 675020 167373
?.. ..- attr(*, "dimnames")=List of 2
?.. .. ..$ : chr [1:2] "X" "Y"
?.. .. ..$ : chr [1:2] "min" "max"
?..@ proj4string:Formal class 'CRS' [package "sp"] with 1 slots
?.. .. ..@ projargs: chr NA
# Interpolate and write the interpolated data to a file:
list_ked <- vector("list",5)
for(i in 1:5){
?list_ked[[i]] <- krige(Prec00[,1]~Z, locations=DataCoord, newdata=elev, model = fitted_vario)
}
## Write files
for(i in 1:5){
? ?data_int_ked <- list_ked[[i]]
? ?gridded(data_int_ked) = TRUE
? ?fullgrid(data_int_ked) = TRUE
? ?name1 <- sprintf("KEDelevpred_zeros_hr_%i.asc",i)
? ?write.asciigrid(data_int_ked[1], name1)
}
? ? ? ?[[alternative HTML version deleted]]
_______________________________________________ R-sig-Geo mailing list R-sig-Geo at stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-geo