|
|
@ -9,13 +9,14 @@ coastsnap_sites_csv = pd.read_csv(sites_csv_path)
|
|
|
|
images_parent_dir = coastsnap_sites_csv.parent_directory[0]
|
|
|
|
images_parent_dir = coastsnap_sites_csv.parent_directory[0]
|
|
|
|
images_dir = os.path.join(images_parent_dir, "Images")
|
|
|
|
images_dir = os.path.join(images_parent_dir, "Images")
|
|
|
|
|
|
|
|
|
|
|
|
stats_csv = pd.DataFrame(columns = ['site','# processed', '# photoshop', '# registered', 'stability', 'most recently deleted'] )
|
|
|
|
stats_csv = pd.DataFrame(columns = ['site','# processed', '# photoshop', '# registered', 'stability', 'most recently deleted', 'latest_processed', 'latest_registered'] )
|
|
|
|
|
|
|
|
|
|
|
|
print("Retrieving snapshot for:")
|
|
|
|
print("Retrieving snapshot for:")
|
|
|
|
for site in os.listdir(images_dir): # Loop through SITES
|
|
|
|
for site in os.listdir(images_dir): # Loop through SITES
|
|
|
|
i=0
|
|
|
|
i=0
|
|
|
|
|
|
|
|
latest_processed_found = False
|
|
|
|
print(site)
|
|
|
|
print(site)
|
|
|
|
to_append = [site, 0, 0, 0, 0, 'None deleted']
|
|
|
|
to_append = [site, 0, 0, 0, 0, 'None deleted',None,None]
|
|
|
|
processed = False
|
|
|
|
processed = False
|
|
|
|
photoshop = False
|
|
|
|
photoshop = False
|
|
|
|
registered = False
|
|
|
|
registered = False
|
|
|
@ -65,8 +66,23 @@ for site in os.listdir(images_dir): # Loop through SITES
|
|
|
|
year_path = os.path.join(photoshop_path, year)
|
|
|
|
year_path = os.path.join(photoshop_path, year)
|
|
|
|
image_list = os.listdir(year_path)
|
|
|
|
image_list = os.listdir(year_path)
|
|
|
|
image_list.reverse()
|
|
|
|
image_list.reverse()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Add latest processed image date
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
if os.path.isfile(year_path + '/' + image_list[0]) and latest_processed_found == False:
|
|
|
|
|
|
|
|
latest_processed_found = True
|
|
|
|
|
|
|
|
print(image_list[0])
|
|
|
|
|
|
|
|
filename_list1 = image_list[0].split(".")
|
|
|
|
|
|
|
|
date = filename_list1[3].split("_")
|
|
|
|
|
|
|
|
image_date1 = date[0] + '-' + '{:02d}'.format(strptime(filename_list1[2],'%b').tm_mon) +'-'+ filename_list1[5]
|
|
|
|
|
|
|
|
to_append[6] = image_date1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
except:
|
|
|
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
for image_filename in image_list: # Loop through IMAGES
|
|
|
|
for image_filename in image_list: # Loop through IMAGES
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Grab the latest image date in Processed
|
|
|
|
year_path = year_path.replace('Photoshop', 'Registered')
|
|
|
|
year_path = year_path.replace('Photoshop', 'Registered')
|
|
|
|
image_filename_no_suffix = image_filename.replace("_tagged","");
|
|
|
|
image_filename_no_suffix = image_filename.replace("_tagged","");
|
|
|
|
registered_image_path = year_path + '/' + image_filename_no_suffix[:-4] + '_registered.jpg'
|
|
|
|
registered_image_path = year_path + '/' + image_filename_no_suffix[:-4] + '_registered.jpg'
|
|
|
@ -74,6 +90,19 @@ for site in os.listdir(images_dir): # Loop through SITES
|
|
|
|
# Finding the Latest Deleted Image Logic:
|
|
|
|
# Finding the Latest Deleted Image Logic:
|
|
|
|
# Iterate through 'Images/Processed'
|
|
|
|
# Iterate through 'Images/Processed'
|
|
|
|
if os.path.isfile(registered_image_path): # Find the latest registered image.
|
|
|
|
if os.path.isfile(registered_image_path): # Find the latest registered image.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Add latest registered image date
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
if latest_registered_image_found == False:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
filename_list2 = image_filename.split(".")
|
|
|
|
|
|
|
|
date = filename_list2[3].split("_")
|
|
|
|
|
|
|
|
image_date2 = date[0] + '-' + '{:02d}'.format(strptime(filename_list2[2],'%b').tm_mon) +'-'+ filename_list2[5]
|
|
|
|
|
|
|
|
to_append[7] = image_date2
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
except:
|
|
|
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
latest_registered_image_found = True # This is so the latest deleted image
|
|
|
|
latest_registered_image_found = True # This is so the latest deleted image
|
|
|
|
# isn't just the most recent image
|
|
|
|
# isn't just the most recent image
|
|
|
|
|
|
|
|
|
|
|
@ -111,7 +140,7 @@ for i, row in stats_csv.iterrows():
|
|
|
|
if stats_csv.at[i, '# photoshop'] != 0:
|
|
|
|
if stats_csv.at[i, '# photoshop'] != 0:
|
|
|
|
stability = "{0:.0%}".format(stats_csv.at[i, '# registered'] / stats_csv.at[i, '# photoshop'])
|
|
|
|
stability = "{0:.0%}".format(stats_csv.at[i, '# registered'] / stats_csv.at[i, '# photoshop'])
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
stability = 'NaN' # or whatever value makes sense in your context
|
|
|
|
stability = None # or whatever value makes sense in your context
|
|
|
|
stats_csv.at[i,'stability'] = stability
|
|
|
|
stats_csv.at[i,'stability'] = stability
|
|
|
|
|
|
|
|
|
|
|
|
stats_csv.set_index('site', inplace = True)
|
|
|
|
stats_csv.set_index('site', inplace = True)
|
|
|
|