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
[email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo