Hope this email finds you well.
I can run r.cross in console with following command:
“r.cross -z --overwrite --quiet input=Connect_Lake@PERMANENT,str_grass_r@PERMANENT output=test”
But I got error by run r.cross in python with following command:
grass.run_command(‘r.cross’, input = [‘str_grass_r@PERMANENT’,‘Connect_Lake@PERMANENT’],output = ‘test’, quiet = True)
What is the correct format to use r.cross function in Python? and how to obtain the output table generated by r.cross?
Please provide more information:
GRASS version
Python version
exact error message
I did not observe any errors while running command you provided (of
course I used different map names to match map names I had on my
system).
Māris.
otrd., 2020. g. 17. nov., plkst. 06:04 — lietotājs ming han
(<dustming@gmail.com>) rakstīja:
Hi Everyone
Hope this email finds you well.
I can run r.cross in console with following command:
"r.cross -z --overwrite --quiet input=Connect_Lake@PERMANENT,str_grass_r@PERMANENT output=test"
But I got error by run r.cross in python with following command:
grass.run_command('r.cross', input = ['str_grass_r@PERMANENT','Connect_Lake@PERMANENT'],output = 'test', quiet = True)
What is the correct format to use r.cross function in Python? and how to obtain the output table generated by r.cross?
Hope this email finds you well.
I can run r.cross in console with following command:
“r.cross -z --overwrite --quiet input=Connect_Lake@PERMANENT,str_grass_r@PERMANENT output=test”
But I got error by run r.cross in python with following command:
grass.run_command(‘r.cross’, input = [‘str_grass_r@PERMANENT’,‘Connect_Lake@PERMANENT’],output = ‘test’, quiet = True)
What is the correct format to use r.cross function in Python? and how to obtain the output table generated by r.cross?
This worked fine for me also, using GRASS 7.8.4 in the nc_basin_spm LOCATION:
In [2]: import grass.script as gscript
In [3]: gscript.run_command("r.cross", input=["landuse@PERMANENT","basins@PERMANENT"], output="lu_bas", overwrite=True) r.cross: STEP 1 ... 100% r.cross: STEP 2 ... r.cross: STEP 3 ... 100% Creating support files for <lu_bas>... 89 categories Out[3]: 0
Just to be clear, you do not get a table output, rather a raster. In your case you should see a new raster “test”.
Thanks
Ming
_______________________________________________
grass-user mailing list
[grass-user@lists.osgeo.org](mailto:grass-user@lists.osgeo.org)
[https://lists.osgeo.org/mailman/listinfo/grass-user](https://lists.osgeo.org/mailman/listinfo/grass-user)
Hope this email finds you well.
I can run r.cross in console with following command:
“r.cross -z --overwrite --quiet input=Connect_Lake@PERMANENT,str_grass_r@PERMANENT output=test”
But I got error by run r.cross in python with following command:
grass.run_command(‘r.cross’, input = [‘str_grass_r@PERMANENT’,‘Connect_Lake@PERMANENT’],output = ‘test’, quiet = True)
What is the correct format to use r.cross function in Python? and how to obtain the output table generated by r.cross?
This worked fine for me also, using GRASS 7.8.4 in the nc_basin_spm LOCATION:
In [2]: import grass.script as gscript
In [3]: gscript.run_command("r.cross", input=["landuse@PERMANENT","basins@PERMANENT"], output="lu_bas", overwrite=True) r.cross: STEP 1 ... 100% r.cross: STEP 2 ... r.cross: STEP 3 ... 100% Creating support files for <lu_bas>... 89 categories Out[3]: 0
Just to be clear, you do not get a table output, rather a raster. In your case you should see a new raster “test”.
Thanks
Ming
_______________________________________________
grass-user mailing list
[grass-user@lists.osgeo.org](mailto:grass-user@lists.osgeo.org)
[https://lists.osgeo.org/mailman/listinfo/grass-user](https://lists.osgeo.org/mailman/listinfo/grass-user)