<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<DEFANGED_META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<DEFANGED_META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7226.0">
<TITLE>SV: SV: [STATSGRASS] spgrass6 rastget6 bug??</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->

<P><TT><FONT SIZE=2>If you can download the source package and edit that line in the only file in the R directory, then do R CMD INSTALL spgrass6, you'll get a version with your change which will stay around between R sessions. An even faster way is to say fix(readFLOAT6sp), you can edit it for that session (and maybe save it with<BR>
sink(&quot;new_version.R&quot;) etc.<BR>
<BR>
I'll change the function in the package when I have access to the codebase.<BR>
<BR>
Roger<BR>
<BR>
<BR>
---<BR>
Roger Bivand, NHH, Helleveien 30, N-5045 Bergen,<BR>
Roger.Bivand@nhh.no<BR>
<BR>
<BR>
<BR>
-----Opprinnelig melding-----<BR>
Fra: Ulrich Leopold [<A HREF="mailto:uleopold@science.uva.nl">mailto:uleopold@science.uva.nl</A>]<BR>
Sendt: to 23.03.2006 15:17<BR>
Til: Roger Bivand<BR>
Kopi: uleopold@science.uva.nl; statsgrass@grass.itc.it<BR>
Emne: Re: SV: [STATSGRASS] spgrass6 rastget6 bug??<BR>
<BR>
&gt; Please try the command by hand within R with debug(rast.get6). When<BR>
&gt; rast.get6() calls other interface functions, please enter debug(that_function)<BR>
&gt; to follow the trail all the way back to the command that is giving the<BR>
&gt; progress report. If the annoying progress percentages are on stderr, probably<BR>
&gt; they can be caught somewhere, but first we need to see where they are coming<BR>
&gt; from and stop them.<BR>
<BR>
Roger, I used<BR>
<BR>
debug(rast.get6(c(&quot;surface_alzette_sealed&quot;, &quot;precip_obkp&quot;), cat=c(TRUE,FALSE)))<BR>
<BR>
but it did not stop anywhere and produced a large entry in the RAM (1.5GB).<BR>
But I was watching the processes and it came to my mind that r.out.arc could<BR>
cause teh problem. So I checked on the GRASS commandline to be sure and it<BR>
indeed gives the progress percentage.<BR>
<BR>
So I used the following command to stop GRASS writing a message to stderr:<BR>
<BR>
r.out.arc input=map output=map.txt 2&gt;/dev/null<BR>
<BR>
This command &quot;r.out.arc&quot; is used by readFLOAT6sp in rast.get6 on line 11 (here<BR>
line 12). But where can I built in now &quot;2&gt;/dev/null&quot; there and write the new<BR>
function?<BR>
<BR>
readFLOAT6sp<BR>
function (vname)<BR>
{<BR>
&nbsp;&nbsp;&nbsp; pid &lt;- as.integer(round(runif(1, 1, 1000)))<BR>
&nbsp;&nbsp;&nbsp; p4 &lt;- CRS(getLocationProj())<BR>
&nbsp;&nbsp;&nbsp; for (i in seq(along = vname)) {<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gtmpfl1 &lt;- system(paste(&quot;g.tempfile pid=&quot;, pid, sep = &quot;&quot;),<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; intern = TRUE)<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rtmpfl1 &lt;- ifelse(.Platform$OS.type == &quot;windows&quot;,<BR>
system(paste(&quot;cygpath -w&quot;,<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gtmpfl1, sep = &quot; &quot;), intern = TRUE), gtmpfl1)<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; system(paste(&quot;r.out.arc input=&quot;, vname[i], &quot; output=&quot;,<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gtmpfl1, sep = &quot;&quot;))<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; res &lt;- readAsciiGrid(rtmpfl1, colname = vname[i], proj4string = p4)<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; to_int &lt;- length(which(unlist(strsplit(system(paste(&quot;r.info -t&quot;,<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; vname[i]), intern = TRUE), &quot;=&quot;)) == &quot;CELL&quot;)) &gt; 0<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (to_int)<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; res@data[[1]] &lt;- as.integer(res@data[[1]])<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; unlink(rtmpfl1)<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (i == 1)<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; resa &lt;- res<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else {<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; grida &lt;- getGridTopology(resa)<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; grid &lt;- getGridTopology(res)<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (!isTRUE(all.equal(grida, grid)))<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; stop(&quot;topology is not equal&quot;)<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; onames &lt;- c(names(resa@data), names(res@data))<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ncols &lt;- dim(resa@data)[2]<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lst &lt;- vector(mode = &quot;list&quot;, length = ncols + 1)<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; names(lst) &lt;- onames<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for (i in 1:ncols) lst[[i]] &lt;- resa@data[[i]]<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lst[[ncols + 1]] &lt;- res@data[[1]]<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; resa &lt;- SpatialGridDataFrame(grid = grida, data = AttributeList(lst),<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; proj4string = p4)<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>
&nbsp;&nbsp;&nbsp; }<BR>
&nbsp;&nbsp;&nbsp; resa<BR>
}<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
&gt; ---<BR>
&gt; Roger Bivand, NHH, Helleveien 30, N-5045 Bergen,<BR>
&gt; Roger.Bivand@nhh.no<BR>
&gt;<BR>
&gt;<BR>
&gt;<BR>
&gt; -----Opprinnelig melding-----<BR>
&gt; Fra: statsgrass-admin@grass.itc.it på vegne av Ulrich Leopold<BR>
&gt; Sendt: to 23.03.2006 10:58<BR>
&gt; Til: statsgrass@grass.itc.it<BR>
&gt; Emne: [STATSGRASS] spgrass6 rastget6 bug??<BR>
&gt;<BR>
&gt; Dear list,<BR>
&gt;<BR>
&gt; I am trying to automate some statistics with the help of the latest version of<BR>
&gt; spgrass6 and rastget6. The problem I encounter is that when I load maps from<BR>
&gt; within GRASS-6.0.1 with<BR>
&gt;<BR>
&gt; alzette &lt;- rast.get6(c(&quot;surface_alzette_sealed&quot;, &quot;precip_obkp&quot;), cat=c(TRUE,<BR>
&gt; FALSE))<BR>
&gt;<BR>
&gt; it shows a progress which only counts to 96%. Then this number blocks the next<BR>
&gt; command in a script. The only way to get around it is to press return on the<BR>
&gt; command line which I cannot do in the script.<BR>
&gt;<BR>
&gt; Is this a bug. And if yes. Do you know any work arounds?<BR>
&gt;<BR>
&gt; Any help appreciated.<BR>
&gt;<BR>
&gt; Cheers, Ulrich<BR>
<BR>
<BR>
</FONT></TT>
</P>

</BODY>
</HTML>