I am new to ModelBuilder and Python scripting.
I am trying to create a model which selects each feature within a dataset, uses a select by location to select all features within a 50m radius, and from the selection results, return the maximum value in particular field.
And the settings + python script I am using in the Calculate field is:
fc = "Sample_Area_Layer"
field = "nNCC_1"
Cursor = arcpy.SearchCursor(fc)
row = Cursor.next()
MaxValue = 0
CurrentValue = 0
for row in Cursor:
CurrentValue = row.getValue(field)
if CurrentValue > MaxValue:
MaxValue = CurrentValue
Cursor.next
The results which are being returned are inconsistent. Some have values which are not in the selection, others have values which are not the maximum value of the selected values - so although the Maximum Value may infact be 9 the formula is only picking up a maximum value of 4.