Try changing your expression variable to:expression = "round(!WSPD_SFC!/5.0, 0) * 5.0"Since the expression is quoted as a string, it will not read 'input' as a variable. It will read this as a string literal.
expression = "round(!WSPD_SFC!/5.0, 0) * 5.0"
# Import modules import arcpy import math # Local variables: point_shp = "R:\\Tornado Research\\test\\SfcOA.shp" newfield = R_WsdpSfc input = "getclass(double(!WSPD_SFC!))" #Not sure how to get the input file in this line of code expression = "round([input]/5.0, 0) * 5.0" #Not sure if this is the correct way of doing this line # Process: Add Field arcpy.AddField_management(point_shp, newfield, "DOUBLE", "", "", "25", "", "NON_NULLABLE", "NON_REQUIRED", "") # Works fine # Execute CalculateField arcpy.CalculateField_management(point_shp, newfield, expression, "PYTHON") #Obviously this line is broken
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.