1

So I have an aspect raster that was created from a DEM. I'm trying to reclassify it using python, but I'm running into some issues. Here's the setup:

I need to reclassify values in the aspect raster that are between 315 and 360 to 1.2, between 0 and 45 to 1.2, between 135 and 225 to 0.8, and everything else to 1.0.

I've tried:

outAspect_Reclass = arcpy.sa.Reclassify(outAspect,"Value","0 44.99999 1.2;45 134.99999 1;135 224.99999 0.8;225 314.99999 1;315 360 1.2","NODATA")

And I've tried:

outAspect_Reclass = Float(Con((outAspect >= 0.0) and (outAspect <= 45.0), 1.2, Con((outAspect >= 135.0) and (outAspect <= 225.0), 0.8, Con((outAspect >= 315.0) and (outAspect <= 360.0), 1.2, 1.0))))

The first try fails because Reclassify won't reclassify to floats, and I'm not sure about the second try- can the Con() function do ranges (>=/<=)?

Can anyone tell me how to get this to work?

1

As stated in the comments, the Con tool uses the '&' operator, not 'and'.

Edit: to clarify, 'and' also worked up until ArcGIS 9.3 (map algebra operators).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.