AnsweredAssumed Answered

Python in Field Calculator - mod function

Question asked by recurvata on Jan 16, 2014
Latest reply on Jan 16, 2014 by recurvata
There are two fields in a topo line feature class, Elev for elevation and LineType10. I want to set LineType10 to 1 if Elev % 10 == 0, and 2 otherwise. The purpose is to be able to symbolize at ten foot intervals. I've got the code below, which doesn't give errors but also doesn't set any values. I've also used the plain % mod symbol. Any ideas why this doesn't run? Thanks.

Pre-Logic
def SetTen(elv, line):   if math.fmod(elv) == 0:     line = 1   else:     line = 2   return line


Window
SetTen( !Elev!, !LineType10!)

Attachments

Outcomes