I am trying to use the Calculate Field tool in Model Builder using python (not VB) to convert from meters to miles.
Some records are null, in which case I want them to stay as null.
So, in the expression line (using Python 9.3), if I use the following, then nulls become 0, where in VB these would remain as null:
(!HabitatDistance!) * 0.000621371192
I've also tried to use Calc and Reclass with a variety of if, else statements, but none of those seem to work. I just get 0's for null input values.
e.g.
Expression: Calc(float(!HabitatDistance_mi!),float(!HabitatDistance_m!))
Codeblock:
def Calc(dist1,dist2):
if dist2 == None:
return None
else:
return dist2 * 0.000621371192
Any solutions?