Hi all,<div><br></div><div>I need a little help with r.mapcalc syntax in Python script. I want to convert the following formula:</div><div><br></div><div>grass.run_command('r.mapcalculator', amap = r_stream+'_nothin' , formula = '%s*%s' % (r_stream+'_nothin', r_mask) , outfile = r_stream+'_nothin', overwrite = True)</div>
<div><br></div><div>I want to use r.mapcalc instead of r.mapcalculator. So I write:</div><div><br></div><div><div>grass.mapcalc("$r_stream_nothin = $r_stream_nothin * $r_mask",</div><div> r_mask = r_mask,</div>
<div> r_stream_nothin = r_stream+'_nothin')</div><div><br></div><div>but I get parse error. What's the correct way to do this? The aim is to add the suffix '_nothin' to the existing variable name r_stream. </div>
<div>Thank you in advance.</div><div><br></div><div>Regards,</div><div>madi</div><div><br></div>-- <br><span style="color:rgb(102, 102, 102)">Eng. Margherita Di Leo</span><br style="color:rgb(102, 102, 102)"><span style="color:rgb(102, 102, 102)">Ph.D. Candidate</span><br style="color:rgb(102, 102, 102)">
<span style="color:rgb(102, 102, 102)">Methods and Technologies for Environmental Monitoring</span><br style="color:rgb(102, 102, 102)"><span style="color:rgb(102, 102, 102)">Department of Environmental Engineering and Physics (DIFA)</span><br style="color:rgb(102, 102, 102)">
<br style="color:rgb(102, 102, 102)"><span style="color:rgb(102, 102, 102)">University of Basilicata </span><br style="color:rgb(102, 102, 102)"><span style="color:rgb(102, 102, 102)">Campus Macchia Romana</span><br style="color:rgb(102, 102, 102)">
<span style="color:rgb(102, 102, 102)">85100 - Potenza </span><br style="color:rgb(102, 102, 102)"><span style="color:rgb(102, 102, 102)">Italy</span><br style="color:rgb(102, 102, 102)"><br style="color:rgb(102, 102, 102)">
<span style="color:rgb(102, 102, 102)">Office: +39-0971205360</span><br style="color:rgb(102, 102, 102)"><span style="color:rgb(102, 102, 102)"></span><br><br><br>
</div>