So I am writing a script to perform a Union on multiple feature data sets.

Feature data sets: R1ADS1999Damage, R1ADS2000Damage.....R1ADS2013Damage (these are all polygon feature classes with the same attribute fields years 1999-2013)

I need to join the first (1999) year to the next year, naming the joined feature class R1ADS1999-2000Damage, and then add three new fields called: TPA_1999_2000; Acres_1999_2000 and; NoTrees_1999_2000. Each new field is calculated with a unique (field calculator) expression. I will provide these calculations in a moment. Once the fields are added and the values calculated the newly created unioned feature class, R1ADS1999-2000Damage, needs to be unioned to R1ADS2001Damage, the next chronological year. Fields called TPA_1999_2001; Acres_1999_2001 and; NoTrees_1999_2001 need to be added and calculated. This pattern continues until the final year 2013.

TPA_1999_2000 = Is the sum of field TPA_1999 + TPA_2000, after the next union the TPA_1999_2001= TPA_1999_2000+TPA_2001 this pattern continues for after all unions.

Acres_1999_2000= Is a recalculation of geometry after the union, in Acres. This is the same for all subsequent unions.

No_Trees_1999_2000= Is TPA_1999_2000 * Acres_1999_2000. After the next union the NoTrees_1999_2001= TPA_1999_2001*Acres1999_2001

I have managed to get the union and adding fields part of the script done, see below. I got stuck on writing the Field Calculator expression for the TPA_1999_20XX.

It seems that I need an expression that sums all of the fields that begin with TPA_ something like

TPA_1999_2000= sum([!TPA_*!) However this does not work.

So here is the code I have come up with so far until got stuck:

##################################################

R1="R1ADS"

Dam="Damage"

years=['1999','2000', '2001', '2002', '2003', '2004', '2005', '2006', '2007', '2008', '2009', '2010', '2011', '2012', '2013']

fields=['TPA_','Acres_','NoTrees_']

RangeYear= ['1999_2000','1999_2001','1999_2002','1999_2003','1999_2004','1999_2005','1999_2006','1999_2007','1999_2008','1999_2009','1999_2010','1999_2011','1999_2012','1999_2013']

expression=['TPA_ expression', 'Acres_expression', 'NoTree_expession'] ### Note these are place holders for the correct expressions that I need help with.

arcpy.Union_analysis([R1+years[0]+Dam,R1+years[1]+Dam],R1+years[0]+"_"+years[1]+Dam)

for i in range(0,13) :

arcpy.Union_analysis([R1+years[0]+"_"+years[i+1]+Dam,R1+years[i+2]+Dam],R1+years[0]+"_"+years[i+2]+Dam)

print years[0]+'_'+years[i+2]+" union done"

for j in range(0,3):

arcpy.AddField_management(R1+years[0]+'_'+years[i+2]+Dam, fields[j]+RangeYear[i], "FLOAT","","","")

arcpy.CalculateField_Management(R1+years[0]+'_'+years[i+2]+Dam, fields[j]+RangeYear[i],expression[j])

I would appreciate any help you can give, please do not worry about insulting me I am new to programming.

Thanks

Are you writing this in code(which? ie python) or model builder? Are the polys all the same or varying sizes?

Edit: You may also want to move to a more appropriate place GeoNet Help is for help with GeoNet