Converting from DMS to DD using Python in Field Calculator?
Take a look at the section on slicing in the Python tutorial. You can grab a range of characters from a string using slicing syntax, e.g.
D = int(x[1:2])
.For seconds, try
S = float(x[5:])
. This will grab all the characters starting at index 5 to the end of the string, in the case that you have variable length values for seconds.- The
!FieldName!
syntax is only valid in the expression box. You have to define a function in the "pre-logic" section that takes in the values of the fields you want and returns the desired value. Then, in the expression box, call the function and pass in the field values using the!FieldName!
syntax. See Calculate Field examples in the help.