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

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!)

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.