Hello

I´m trying to calclulate Wind Speed from u and v Values which I have in an Attribute Table. Basically the function should calclulate when u and v are simultaneously different from 0

If u and v are simultaneously different from 0 then the function should calculate

Sqr(u**2 + v **2)

In the Code-Block I typed:

Dim z as double

u = [GRID_COD_1]

v = [GRID_CODE]

If (( u = 0) And (v = 0)) Then

z = 0

elseIf (( u <> 0) and (v <> 0)) Then

z= Sqr(( u **2) + (v **2))

EndIf

and after that

z=speed

but it diosnt seem to work. What do I do wrong?

Greets,

Christian

Someone is going to tell me how to comment with proper python syntax, and i forgot how so that comment is welcome.

assuming "z" is your wind speed field.

switch to python .

in the top box

-------------------------------------------

def myupdate(u,v):

if u == 0 and v == 0:

return 0

else:

return math.sqrt(math.pow( u ,2)+ math.pow( v ,2))

----------------------------------------------------

bottom box

---------------------------------------------------

myupdate( !u! , !v! )

-------------------------------------------------------

this should work