SV: [STATSGRASS] spgrass6 rastget6 bug??
Roger Bivand
Roger.Bivand at nhh.no
Fri Mar 24 02:33:11 EST 2006
On Thu, 23 Mar 2006, Ulrich Leopold wrote:
Ulrich:
Assuming you are not running under cygwin, please install the attached
draft release. All the functions calling system() now have an
ignore.stderr= function (default FALSE) which can be set TRUE, so:
rast.get6(c("surface_alzette_sealed", "precip_obkp"), cat=c(TRUE,FALSE),
ignore.stderr=TRUE)
should work and be more platform-independent that using /dev/null
(/dev/null is C:\ on Windows??)
The arguments are not documented yet, that'll come later. I'm afraid that
you may also need to install the rgdal package, because your request
caught me during other revision work that is not yet complete.
Please report back whether this solves your problem.
Roger
> > Please try the command by hand within R with debug(rast.get6). When
> > rast.get6() calls other interface functions, please enter debug(that_function)
> > to follow the trail all the way back to the command that is giving the
> > progress report. If the annoying progress percentages are on stderr, probably
> > they can be caught somewhere, but first we need to see where they are coming
> > from and stop them.
>
> Roger, I used
>
> debug(rast.get6(c("surface_alzette_sealed", "precip_obkp"), cat=c(TRUE,FALSE)))
>
> but it did not stop anywhere and produced a large entry in the RAM (1.5GB).
> But I was watching the processes and it came to my mind that r.out.arc could
> cause teh problem. So I checked on the GRASS commandline to be sure and it
> indeed gives the progress percentage.
>
> So I used the following command to stop GRASS writing a message to stderr:
>
> r.out.arc input=map output=map.txt 2>/dev/null
>
> This command "r.out.arc" is used by readFLOAT6sp in rast.get6 on line 11 (here
> line 12). But where can I built in now "2>/dev/null" there and write the new
> function?
>
> readFLOAT6sp
> function (vname)
> {
> pid <- as.integer(round(runif(1, 1, 1000)))
> p4 <- CRS(getLocationProj())
> for (i in seq(along = vname)) {
> gtmpfl1 <- system(paste("g.tempfile pid=", pid, sep = ""),
> intern = TRUE)
> rtmpfl1 <- ifelse(.Platform$OS.type == "windows",
> system(paste("cygpath -w",
> gtmpfl1, sep = " "), intern = TRUE), gtmpfl1)
> system(paste("r.out.arc input=", vname[i], " output=",
> gtmpfl1, sep = ""))
> res <- readAsciiGrid(rtmpfl1, colname = vname[i], proj4string = p4)
> to_int <- length(which(unlist(strsplit(system(paste("r.info -t",
> vname[i]), intern = TRUE), "=")) == "CELL")) > 0
> if (to_int)
> res at data[[1]] <- as.integer(res at data[[1]])
> unlink(rtmpfl1)
> if (i == 1)
> resa <- res
> else {
> grida <- getGridTopology(resa)
> grid <- getGridTopology(res)
> if (!isTRUE(all.equal(grida, grid)))
> stop("topology is not equal")
> onames <- c(names(resa at data), names(res at data))
> ncols <- dim(resa at data)[2]
> lst <- vector(mode = "list", length = ncols + 1)
> names(lst) <- onames
> for (i in 1:ncols) lst[[i]] <- resa at data[[i]]
> lst[[ncols + 1]] <- res at data[[1]]
> resa <- SpatialGridDataFrame(grid = grida, data = AttributeList(lst),
> proj4string = p4)
> }
> }
> resa
> }
>
>
>
>
>
> > ---
> > Roger Bivand, NHH, Helleveien 30, N-5045 Bergen,
> > Roger.Bivand at nhh.no
> >
> >
> >
> > -----Opprinnelig melding-----
> > Fra: statsgrass-admin at grass.itc.it på vegne av Ulrich Leopold
> > Sendt: to 23.03.2006 10:58
> > Til: statsgrass at grass.itc.it
> > Emne: [STATSGRASS] spgrass6 rastget6 bug??
> >
> > Dear list,
> >
> > I am trying to automate some statistics with the help of the latest version of
> > spgrass6 and rastget6. The problem I encounter is that when I load maps from
> > within GRASS-6.0.1 with
> >
> > alzette <- rast.get6(c("surface_alzette_sealed", "precip_obkp"), cat=c(TRUE,
> > FALSE))
> >
> > it shows a progress which only counts to 96%. Then this number blocks the next
> > command in a script. The only way to get around it is to press return on the
> > command line which I cannot do in the script.
> >
> > Is this a bug. And if yes. Do you know any work arounds?
> >
> > Any help appreciated.
> >
> > Cheers, Ulrich
>
>
--
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no
-------------- next part --------------
A non-text attachment was scrubbed...
Name: spgrass6_0.2-2.tar.gz
Type: application/x-gzip
Size: 3955 bytes
Desc:
Url : http://lists.osgeo.org/pipermail/grass-stats/attachments/20060324/1ad12d9e/spgrass6_0.2-2.tar.gz
More information about the grass-stats
mailing list