TransWikia.com

Trying to recode raster with CSV using the Grass r.recode.attr but getting error "name 'xrange' is not defined"

Geographic Information Systems Asked by David Bartecchi on August 29, 2021

I’m trying to recode a large GSSURGO soil raster with CSV using the Grass r.recode.attr following these instructions https://pvanb.wordpress.com/2014/12/13/recode-your-raster-file-in-grass-gis-using-a-csv-file/ but I’m getting error “name ‘xrange’ is not defined”

When I looked it up I found that this issue may be because “xrange” changed to “range” in the transition from from Python 2 to Python 3. The instructions for the r.recode.attr module are from 2014 and I can’t find much else out there the talks about r.recode.attr. However, it seems like a very valuable tool.

My raster, instead of being classed by values has a unique key which only has meaning if you can reclassify it from a related CSV table. Does anyone know of any alternative using GRASS or QGIS?

One Answer

Please update your installation of the GRASS GIS addon r.recode.attr to the latest version. I have updated it to be Python 3 compliant (https://github.com/OSGeo/grass-addons/pull/91 - xrange compatibility fix).

The addon now works.

Answered by markusN on August 29, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP