Dear all, kindly help me with this code;

This script  is supposed to calculate Rvi for each row by first summing the 
product of #fields (Ai*Rv) and dividing by another field (Tot) such that  
Rvi=sum(Ai*Rv)/Tot. First it's acting like I need another parenthesis and it 
doesn't seem to work at all. i even imported the math module, but not sure if a 
need it. Please advice, your help is highly appreciated.  Please see the code 
below:

import arcpy, math
arcpy.Workspace = "C:\\data\\basins.mdb"
fc = "wshed"
sum = 0
        
# Create the update cursor and advance the cursor to the first row
cur = arcpy.UpdateCursor(fc)
row = cur.Next()
# Perform the update and move to the next row as long as there are
#  rows left
for row:
    row.GetValue(Rvi) = sum(row.Ai*row.Rv)/row.ATot
    cur.UpdateRow(row)
    row = cur.Next()
# Delete the cursors to remove any data locks
del row, cur  


      
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to