<html style="direction: ltr;">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style id="bidiui-paragraph-margins" type="text/css">body p { margin-bottom: 0cm; margin-top: 0pt; } </style>
</head>
<body bidimailui-charset-is-forced="true" style="direction: ltr;">
<p><br>
</p>
<div class="moz-cite-prefix">On 11/17/20 6:03 AM, ming han wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAD+uAWjhZN36n-ng2-pJVTMcysB-iubRLsCS9tuV3+xCqqspQg@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr">Hi Everyone
<div> </div>
<div> Hope this email finds you well. </div>
<div> I can run r.cross in console with following command: </div>
<div> "r.cross -z --overwrite --quiet
input=Connect_Lake@PERMANENT,str_grass_r@PERMANENT
output=test"</div>
<div> </div>
<div> But I got error by run r.cross in python with following
command: </div>
<div> grass.run_command('r.cross', input =
['str_grass_r@PERMANENT','Connect_Lake@PERMANENT'],output =
'test', quiet = True)</div>
<div><br>
</div>
<div> What is the correct format to use r.cross function in
Python? and how to obtain the output table generated by
r.cross? <br>
</div>
</div>
</blockquote>
<p><br>
</p>
<p><font size="+1">This worked fine for me also, using GRASS 7.8.4
in the nc_basin_spm LOCATION:</font></p>
<p><tt><br>
</tt></p>
<p><tt>In [2]: import grass.script as gscript</tt><tt><br>
</tt><tt><br>
</tt><tt>In [3]: gscript.run_command("r.cross",
input=["landuse@PERMANENT","basins@PERMANENT"], output="lu_bas",
overwrite=True)</tt><tt><br>
</tt><tt>r.cross: STEP 1 ...</tt><tt><br>
</tt><tt> 100%</tt><tt><br>
</tt><tt>r.cross: STEP 2 ...</tt><tt><br>
</tt><tt>r.cross: STEP 3 ...</tt><tt><br>
</tt><tt> 100%</tt><tt><br>
</tt><tt>Creating support files for <lu_bas>...</tt><tt><br>
</tt><tt>89 categories</tt><tt><br>
</tt><tt>Out[3]: 0</tt></p>
<p><font size="+1"><br>
</font></p>
<p><font size="+1">Just to be clear, you do not get a table output,
rather a raster. In your case you should see a new raster
"test".</font></p>
<p><font size="+1"></font><br>
</p>
<blockquote type="cite"
cite="mid:CAD+uAWjhZN36n-ng2-pJVTMcysB-iubRLsCS9tuV3+xCqqspQg@mail.gmail.com">
<div dir="ltr">
<div><br>
</div>
<div>Thanks</div>
<div>Ming</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
grass-user mailing list
<a class="moz-txt-link-abbreviated" href="mailto:grass-user@lists.osgeo.org">grass-user@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/grass-user">https://lists.osgeo.org/mailman/listinfo/grass-user</a></pre>
</blockquote>
<pre class="moz-signature" cols="72">--
Micha Silver
Ben Gurion Univ.
Sde Boker, Remote Sensing Lab
cell: +972-523-665918</pre>
</body>
</html>