Compare commits

..

No commits in common. 'dbdaac512a8646230db9cad48cd037b96862ed3f' and 'd0577f0244ad63fb928b802dd4325d611800ee64' have entirely different histories.

@ -9,14 +9,13 @@ 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', 'latest_processed', 'latest_registered'] ) stats_csv = pd.DataFrame(columns = ['site','# processed', '# photoshop', '# registered', 'stability', 'most recently deleted'] )
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',None,None] to_append = [site, 0, 0, 0, 0, 'None deleted']
processed = False processed = False
photoshop = False photoshop = False
registered = False registered = False
@ -66,23 +65,8 @@ 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'
@ -90,19 +74,6 @@ 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
@ -140,7 +111,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 = None # or whatever value makes sense in your context stability = 'NaN' # 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)

Loading…
Cancel
Save