ArcMap Field Calculator Power function

2356
2
Jump to solution
03-21-2018 03:20 PM
RichardDaniels
Occasional Contributor III

I'm using the field calculator in a model to calculate a field.  I have the following expression, type is set to VB.

0.27 * (  ( Tan ( [RASTERVALU] ) * %Wave Height (Hs)% * %Wave Period (T)% ) ^ (0.5) )

This returns an error. If I remove the Power function (i.e., ^ 0.5) it works. Note, RASTERVALU is not null.

Ideas?

0 Kudos
1 Solution

Accepted Solutions
RichardDaniels
Occasional Contributor III

Ok, found the issue 😉 Need to convert degrees to radians to prevent negative values.

(0.27 * (  ( math.tan ( !RASTERVALU! *  ( 3.14159 / 180 ) ) * %Wave Height (Hs)% * %Wave Period (T)% ) ** (0.5) )) * 1.39

View solution in original post

2 Replies
RichardDaniels
Occasional Contributor III

Ok, found the issue 😉 Need to convert degrees to radians to prevent negative values.

(0.27 * (  ( math.tan ( !RASTERVALU! *  ( 3.14159 / 180 ) ) * %Wave Height (Hs)% * %Wave Period (T)% ) ** (0.5) )) * 1.39

curtvprice
MVP Esteemed Contributor

Yes, degrees to radians AND use the python ** operator, of course using the PYTHON_9.3 parser:

(0.27 * (  ( math.tan ( !RASTERVALU! *  ( 3.14159 / 180 ) ) * 
  %Wave Height (Hs)% * %Wave Period (T)% ) ** (0.5) )) * 1.39‍‍‍

Note the math module has a function for this:

(0.27 * (( math.tan(math.radians(!RASTERVALU!)) 
  * %Wave Height (Hs)% * %Wave Period (T)% ) ** 0.5)) * 1.39‍‍‍‍