Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

what is the python expression for defining a range of numbers? I have tried numerous combinations but cannot get a simple range of angles (100 -200) to compute correctly. Screen shot : Range in Field Calculator needed

screen shot here

share|improve this question
add comment

1 Answer 1

up vote 6 down vote accepted
if !ET_Angle! > 100 and !ET_Angle! < 200

To be more complete, put this in the codeblock:

def LeftOrRight(value):
    if value > 100 and value < 200:
         return "LEFT"
    else:
         return "RIGHT"

And in the calculation area, just put:

LeftOrRight(!ET_Angle!)
share|improve this answer
2  
So many people ignore the codeblock. It can be very powerful. –  Nick Ochoski Jun 15 '11 at 18:13
    
I think they ignore it because the term "code" is rather intimidating unless you are familiar with the language. –  Nathanus Jun 15 '11 at 18:23
    
Awesome! That's just what we needed! Much Thanks!! –  sirgeo Jun 15 '11 at 19:53
    
You got it. Sometimes a few examples can make things clearer. –  Nathanus Jun 15 '11 at 20:17
    
i always save these code solutions and i tried using previously saved codeblocks for this today, but needed further schooling on formulating range expressions... not really intimidated by python just exacerbated sometimes due to time constraints and lack of Google-Fu when looking for the answers... GSE is always a great help for filling in the gaps with Google-Fu . –  sirgeo Jun 15 '11 at 21:57
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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