[GRASS-user] summation
Wolf Bergenheim
wolf+grass at bergenheim.net
Thu Jul 12 17:51:11 EDT 2007
On 12.07.2007 22:51, goldneaa at onid.orst.edu wrote:
> Basically what I need is to have a script that will take create a
> running sum to add to the next raster file. Like (temp.1 +
> temp.2)=Sum.temp. This first sum needs to be added to temp.3. Then the
> loop needs to take action so I can continue to culminate the sums to be
> added to the next map layer.
> Thanks for reaading,
> Aaron
Here is a (t)csh script which will copy up to 2000 maps in lots of 200
#!/usr/bin/tcsh
set tmp=2
set sstr="res=tmp.1"
while($tmp <= 11)
@ t = $tmp - 1
set str="tmp.$t=ts.1"
set i=2
while($i <= 200)
set str="$str+ts.$i"
@ i++
end
echo r.mapcalc $str
r.mapcalc $str
if($tmp <= 10) then
set sstr="$sstr+tmp.$tmp"
endif
@ tmp++
end
echo r.mapcalc $sstr
r.mapcalc $sstr
I'll leave it up to the reader to make code to clean up the temp files ;)
oh BTW if you know bash better you can always write bash scripts and
store them into files and use #!/bin/bash as the first line of the file.
--Wolf
--
<:3 )---- Wolf Bergenheim ----( 8:>
More information about the grass-user
mailing list