armein01

I thought I had update cursor figured out.  But Not!  Please help

Discussion created by armein01 on Feb 18, 2014
Latest reply on Mar 11, 2014 by xander_bakker
I am processing polygons > 60,000.  using zonal stats - All.
I use a loop to select a subset for processing in batches.  Then run the zonal stat to table.
Create a dictionary of the stats and I want to populate back to the original feature class.
the update cursor does not give an error but the attributes of the feature class are not updated.

I wondered if the selection is interfering with the update.

I select by attribute = Lyr1
I select by location = lyr2
Then process zonal stats but maintain a PlygnID which would link the table back to the original feature path.

Inside the loop selecting by layer:
[ CODE]
#Loop through table and update feature values
    updtCur = arcpy.UpdateCursor(wtlndPath)

    for row in updtCur:
        wtlndKey = row.getValue('WVID')
        if wtlndKey in statDict:
            wtlndMean = statDict[(row.getValue('WVID'), 'MEAN')]
            row.setValue("MeanSlp", wtlndMean)
            row.setValue("MaxSlp", statDict[(row.getValue('WVID'), 'MAX')])
            row.setValue("MinSlp", statDict[(row.getValue('WVID'), 'MIN')])
            row.setValue("VarietySlp",statDict[(row.getValue('WVID'), 'VARIETY')])
            row.setValue("MajorSlp", statDict[(row.getValue('WVID'), 'MAJORITY')])
            row.setValue("MinorSlp", statDict[(row.getValue('WVID'), 'MINORITY')])
            row.setValue("StdDevSlp", statDict[(row.getValue('WVID'), 'STD')])
            updtCur.updateRow(row)
    del row, updtCur
[/CODE]


Thanks for any help.

Alicia

Outcomes