1

I've one field "MAXSPEED". I want a Field Calculation that will calculate an additional field ("noise"):

If MAXSPEED> 40 then the term: (73.5 + Log ( 25 ) * ( [MAXSPEED] / 50)) should be used to calculate "noise" but if MAXSPEED < 40 then "noise" should be 71,1

I have no programming experiences. Python or VB, both works for me.

Edit: sl = maxspeed

I figured out the term wasn't alright. This is the right one 73.5 + 25log(sl/50)

import math
def test(sl):
 if sl>=40:
 result = 73.5 + (25*(math.log(sl/50.0))
 elif 30<=sl<40:
 result = 71.1
 else:
 result = 0
 return result

The result for sl = 50 is alright (73.5) but all values>50 are wrong:
sl(60) = 78.06 instead of 75.47
sl(70) = 81,91 instead of 77.15

PolyGeo
65.5k29 gold badges115 silver badges349 bronze badges
asked Jan 19, 2015 at 13:25
0

1 Answer 1

4

in the field calculator, with Python parser, check for "codeblock" and enter

import math
def test(maxspeed):
 if maxspeed >= 40:
 return 73.5 + math.log10(25) * (maxspeed/50)
 else:
 return 71.1 

then enter NOISE =

test(!MAXSPEED!)
answered Jan 19, 2015 at 13:35
0

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.