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!
Solved! Go to Solution.
try the python parser You get access to the math functions
!azim! is the name of an azimuth field in a table
math.radians(!azim!)
!azim!*math.pi/180
try the python parser You get access to the math functions
!azim! is the name of an azimuth field in a table
math.radians(!azim!)
!azim!*math.pi/180
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
why don't you screen the table and your field calculator expression.
it would be easier than working with textual descriptions
you use one or the other in the calculation expression... not both
math.radians(45) == 45*math.pi/180.
True
Okay, my mistake. Here's the new result.
is the field a 'Double' type or is it 'Long' or 'Short'
It is a 'Short' type.
It should be Double if you want to see decimal points in your numbers... short and long are integers