# Converting azimuth from degrees to radians using Field Calculator; only zeros show up.

949
16
10-02-2018 10:11 PM
Highlighted
New Contributor II

I am attempting to convert the azimuth field in a shapefile from degrees to radians using the Field Calculator, but after providing the equation, all the attributes in the new field show up as zero. Equation is [azimuth]*(pi/180). I also tried the calculation using the approximate decimal value of pi/180 and got the same result.

Attached are screenshots of the dialogue window and the problem with the zeros in the attribute table.

Is there a way to fix this without having to use Python or R, and if so how?

Any help would be greatly appreciated!

Tags (3)
1 Solution

Accepted Solutions
Highlighted
MVP Esteemed Contributor

!azim! is the name of an azimuth field in a table

!azim!*math.pi/180

16 Replies
Highlighted
MVP Esteemed Contributor

!azim! is the name of an azimuth field in a table

!azim!*math.pi/180

Highlighted
New Contributor II

I tried that code using the Python parser and got an error that said: "There was a failure during processing. Please check the Geoprocessing window for details." I received Error 000539: Invalid field azim.

I tried again using my field's name, azimuth, in place of azim, and got the same dialogue but with Error 000539: SyntaxError: invalid syntax, (<expression>, line 2). Should there be another pair of parentheses somewhere, perhaps around pi/180?

The only two results I have gotten in all my attempts so far to convert azimuth to radians are either all zeros or this kind of error.

Thanks for your help! Any other suggestions are greatly appreciated.

Best,

Rachel DiPietro

Highlighted
MVP Esteemed Contributor

why don't you screen the table and your field calculator expression.

it would be easier than working with textual descriptions

Highlighted
New Contributor II

Highlighted
MVP Esteemed Contributor

you use one or the other in the calculation expression... not both

True

Highlighted
New Contributor II

Okay, my mistake. Here's the new result.

Highlighted
MVP Esteemed Contributor

is the field a 'Double' type or is it 'Long' or 'Short'

Highlighted
New Contributor II

It is a 'Short' type.

Highlighted
MVP Esteemed Contributor

It should be Double if you want to see decimal points in your numbers... short and long are integers