I'm getting my feet wet with python in the field Calculator. I'm working with contour data and I'm looking to see if someone can help me.
I basically need to do this, but with python.
This works for me:
def setindex(height): dIndexInterval = 50 dCont = height i = dCont / dIndexInterval if ( dCont / dIndexInterval) - i == 0: return 1 else: return 0
setindex( !ELEV! ) in the bottom window where ELEV is the name of your elevation field.
Edit The code given in the link looks buggy, as far as I can tell it will always return 1. The code below should work correctly if modulo is used instead to find the index contours.
def setindex(height): dIndexInterval = 50 dCont = height if dCont % dIndexInterval == 0: return 1 else: return 0