MBadar

Field Calculation in Python

Discussion created by MBadar on Jan 1, 2012
Latest reply on Jan 3, 2012 by MBadar
Hi,
    I have a raster image classified into 10 zones, and a table that has 10 fields corresponding to these zones. I want a way to calculate area of each zone (cell size is known so I can simply multiply count field to the cell size and get the area of each zone. classified image is a user variable so number of zones are subject to change) and divide each column of the table with the corresponding areas to calculate density/percentage/ratio of the area.
    For example
Zones.tif --> Attribute Table

FID Value Count
0  1  157
1  2  576
2  3  21486
.  .   .

XYZ.dbf --> In this example, cell size of zones.tif is 10m

OID Date1 VALUE1 VALUE2 VALUE3 . . .
0  1963_06_06  1570  5760 214860 . . .
1  .  .  .  .  .

XYZ.dbf table is the output of a custom script that I developed in python but I am having difficulty to do this field calculation. Field calculation can be done in the existing table or another table can be created for this.

Any help would be highly appreciated.

Outcomes