Skip to main content
added 624 characters in body
Source Link
Below the Radar
  • 3.6k
  • 1
  • 31
  • 60

you use arcpy.GetParameterAsText() so your threeshold would be a string not float

use arcpy.GetParameter() with input parameter data type defined as double instead

# populate occurrence probability based on percentage thresholds
import arcpy

highThreshold = arcpy.GetParameter(2)
medThreshold = arcpy.GetParameter(3)

with arcpy.da.UpdateCursor(zoneTable, ["PERCENTAGE", "probability"]) as cursor:
    for row in cursor:
        if (row[0] >= highThreshold):
            row[1] = "H"
        elif (row[0] < highThreshold and row[0] >= medThreshold):
            row[1] = "M"
        else:
            row[1] = "L"
        cursor.updateRow(row)
    #delete the cursor when finished
    del cursor

you use arcpy.GetParameterAsText() so your threeshold would be a string not float

use arcpy.GetParameter() with input parameter data type defined as double instead

you use arcpy.GetParameterAsText() so your threeshold would be a string not float

use arcpy.GetParameter() with input parameter data type defined as double instead

# populate occurrence probability based on percentage thresholds
import arcpy

highThreshold = arcpy.GetParameter(2)
medThreshold = arcpy.GetParameter(3)

with arcpy.da.UpdateCursor(zoneTable, ["PERCENTAGE", "probability"]) as cursor:
    for row in cursor:
        if (row[0] >= highThreshold):
            row[1] = "H"
        elif (row[0] < highThreshold and row[0] >= medThreshold):
            row[1] = "M"
        else:
            row[1] = "L"
        cursor.updateRow(row)
    #delete the cursor when finished
    del cursor
Source Link
Below the Radar
  • 3.6k
  • 1
  • 31
  • 60

you use arcpy.GetParameterAsText() so your threeshold would be a string not float

use arcpy.GetParameter() with input parameter data type defined as double instead