[GRASS-user] summation

Wolf Bergenheim wolf+grass at bergenheim.net
Mon Jul 16 15:29:39 EDT 2007


On 13.07.2007 09:22, Wolf Bergenheim wrote:
> 
> That is exactly what this script does. Hmm or should do. But there is a
> bug. here is the correct version:
> 

Nope, still not. This works:

-----------8<-------------------------8<--------------
#!/usr/bin/tcsh

set tmp=2
set sstr="tmp.1"
set erase="tmp.1"
while($tmp <= 11)
  @ t = $tmp - 1
  set str="tmp.$t=temp.1"
  set i=2
  while($i <= 156)
    @ ti = $t * $i
    set str="$str+temp.$ti"
    @ i++
  end
  r.mapcalc $str
  if($tmp <= 10) then
    set sstr="$sstr+tmp.$tmp"
    set erase="$erase,tmp.$tmp"
  endif
  echo "Total progress: ${t}0%"
  @ tmp++
end
r.mapcalc sum=$sstr
echo "Cleaning temporary files..."
g.remove rast=$erase

echo ""
echo "All done. Result is called sum"
-----------8<-------------------------8<--------------

--Wolf

-- 

<:3 )---- Wolf Bergenheim ----( 8:>




More information about the grass-user mailing list