Hi Python experts, I am writing my first python script and would need some advice on how to read and manipulate a list.
On my network drive, I have several folders named after Project and they belong to one or more Years.
I have a FGDB feature class in which I have 2 desired columns FLYING, FILMNAME representing Year, Project respectively.
I would like to read all the rows and create one mosaic data set for each Year and add the Project into each Year's mosaic .
e.g, 1960 will have A;G;J 1972 will have B;D;H
To do this, I would like to get two lists
1. a list of unique Years - to create empty mosaics
2. a list of Projects per Year - to append airphoto folders to each mosaic
Below is the code that does the first list. Any pointers on how to progress further would be much helpful. Thanks in advance.
from arcpy import env
from datetime import datetime
in_fc = r'C:\Working\airphoto.gdb\airphoto_index'
fields = ['FLYING','FILMNAME']
gdb = 'C:\Working\images.gdb'
sourceDir = "O:\\airphoto\\75dpi\\"
in_mosaic = 'C:\Working\images.gdb\test'
prjfile = arcpy.SpatialReference(3857)
Years = 
Films = 
YearFilmString = 
FilmList = 
#read feature class columns and iterate through rows
with arcpy.da.SearchCursor(in_fc,fields) as cursor:
for row in cursor:
#extract year from datetime field
yearString = (str(row)[:4])
filmString = row
uniqYears = sorted(set(Years))
uniqYearsList = list(uniqYears)
#for each year, create one mosaic
for i in uniqYearsList:
x = "C:\Working\images.gdb\T"+i
print "mosaic already exists, skipping..."
print i, "mosaic created"