[GRASSLIST:3416] GRASS scripting question
Thomas.Adams at noaa.gov
Sat May 15 15:10:50 EDT 2004
I have generated 8760 (hourly) maps of radar precipitation fields that I
need to sum to monthly (and daily) totals using r.mapcalc within a Perl
script. I have tried *EVERYTHING* I can do with this but I keep getting
an error related to the shell not properly handling '+'. Namely:
$cmd = "r.mapcalc ". $newmap . "=". $map1;
system $cmd; <--- this works just fine.
But when I try:
$cmd = "r.mapcalc ". $newmap . "=". $map1 ."+". $map2;
system $cmd; <--- this fails.
saying that "+map2" is an invalid command, but the "r.mapcalc
".$newmap."=".$map1 part suceeds. I have also tried using:
$cmd = "r.mapcalc ". $newmap . "=". $map1 ."\+". $map2;
When I try using Perl's 'join' command I get the same error.
How do I do this in a script? Obviously, at the GRASS prompt,
interactively, r.mapcalc works for me.
Thomas E Adams
National Weather Service
Ohio River Forecast Center
1901 South State Route 134
Wilmington, OH 45177
EMAIL: thomas.adams at noaa.gov
More information about the grass-user