An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20081010/8cd3bf6f/attachment.pl>
interp.old and write.ascii.grid
3 messages · Mikael Carlsson, Paul Hiemstra, Tomislav Hengl
Hi, What is the exact error you get? Can you provide a example that reproduces the problem? What kind of system are you running (sessionInfo() output). An idea: The documentation of write.asciigrid says that the variable x (in this case sn8.interpold) should be a SpatialGridDataFrame. Does interp.old give that output (try class(sn8.interpold))? If this is not the case you need to convert the output to a SpatialGridDataFrame. cheers, Paul
Mikael Carlsson wrote:
Hello!
I have a text file that looks like
ew;ns;cures
1394180;6200295;48
1398190;6201020;52
1399690;6200420;59
1395780;6205105;84
1397820;6206590;50
1395290;6208305;46
1394995;6210370;114
1399475;6213715;92
1410825;6214870;48
and so on
I manage to interpolate with
sn8.interpold <- interp.old(ew, ns, cures,
xo= seq(min(ew), max(ew), length = 400),
yo=seq(min(ns), max(ns), length = 300),
ncp = 4, extrap=FALSE, duplicate = "error", dupfun = NULL)
then I want to crate a asciigrid...
write.asciigrid(sn8.interpold,"asciisn8", na.value = -9999)
and here I got problems...
Any tips?
Thanks Mikael
[[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
Drs. Paul Hiemstra Department of Physical Geography Faculty of Geosciences University of Utrecht Heidelberglaan 2 P.O. Box 80.115 3508 TC Utrecht Phone: +31302535773 Fax: +31302531145 http://intamap.geo.uu.nl/~paul
try this:
***********************
library(akima)
library(spatstat)
library(maptools)
ew <- as.vector(c(1394180, 1398190, 1399690, 1395780, 1397820, 1395290, 1394995, 1399475, 1410825))
ns <- as.vector(c(6200295, 6201020, 6200420, 6205105, 6206590, 6208305, 6210370, 6213715, 6214870))
cures <- as.vector(c(48, 52, 59, 84, 50, 46, 114, 92, 48))
sn8 <- data.frame(ew, ns, cures)
coordinates(sn8) <- ~ew+ns
sn8.interpold <- interp(ew, ns, cures, xo= seq(min(ew), max(ew), length = 400), yo=seq(min(ns),
max(ns), length = 300), linear=T)
sn8.interpold.grid <- as.SpatialGridDataFrame.im(as.im(sn8.interpold))
spplot(sn8.interpold.grid, col.regions=bpy.colors(), sp.layout=list("sp.points", pch="+", sn8))
slot(slot(sn8.interpold.grid, "grid"), "cellsize") <- rep(mean(slot(slot(sn8.interpold.grid,
"grid"), "cellsize")), 2)
write.asciigrid(sn8.interpold.grid[1], "asciisn8", na.value = -9999)
***********************
cheers,
Tom Hengl
http://spatial-analyst.net
-----Original Message-----
From: r-sig-geo-bounces at stat.math.ethz.ch [mailto:r-sig-geo-bounces at stat.math.ethz.ch] On Behalf Of
Mikael Carlsson
Sent: vrijdag 10 oktober 2008 9:15
To: r-sig-geo at stat.math.ethz.ch
Subject: [R-sig-Geo] interp.old and write.ascii.grid
Hello!
I have a text file that looks like
ew;ns;cures
1394180;6200295;48
1398190;6201020;52
1399690;6200420;59
1395780;6205105;84
1397820;6206590;50
1395290;6208305;46
1394995;6210370;114
1399475;6213715;92
1410825;6214870;48
and so on
I manage to interpolate with
sn8.interpold <- interp.old(ew, ns, cures,
xo= seq(min(ew), max(ew), length = 400),
yo=seq(min(ns), max(ns), length = 300),
ncp = 4, extrap=FALSE, duplicate = "error", dupfun = NULL)
then I want to crate a asciigrid...
write.asciigrid(sn8.interpold,"asciisn8", na.value = -9999)
and here I got problems...
Any tips?
Thanks Mikael
_______________________________________________
R-sig-Geo mailing list
R-sig-Geo at stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo