minor changes

master
unknown 1 year ago
parent 52b6f1eddd
commit 3cec64493a

@ -3,6 +3,7 @@ import pandas as pd
from pathlib import Path
from time import strptime
code_dir = str(Path(os.getcwd()).parent)
sites_csv_path = os.path.join(code_dir, "coastsnap_sites.csv")
coastsnap_sites_csv = pd.read_csv(sites_csv_path)
@ -71,7 +72,6 @@ for site in os.listdir(images_dir): # Loop through SITES
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]

@ -178,11 +178,11 @@ def main(site):
else: # Stop tagging and go to the next site
site_complete = True;
if i == 0:
print(site + ": " + str(i) + " images tagged")
print(str(i) + " images tagged\n")
elif image2tag and image2tag.tide:
print(site + ": " + str(i) + " images tagged with tide")
print(str(i) + " images tagged with tide\n")
else:
print(site + ": " + str(i) + " images tagged no tide")
print(str(i) + " images tagged no tide\n")
return
@ -193,15 +193,17 @@ def main(site):
pathname = os.path.join(year_path, image_filename)
image2tag = RegisteredImage(pathname, image_filename, registered_image_path) # Create image object
image2tag.get_font()
image2tag.get_dimensions()
if i == 1: # Retrieve Tide Data once for each site
try:
tides_df = get_site_tide_data(images_parent_dir, site)
except:
print("No tide data for " + site)
image2tag.get_font()
image2tag.get_dimensions()
if isinstance(tides_df, pd.DataFrame): # Check if tide data exists
image2tag.get_tide(tides_df)
except:
print("No tide data")
image2tag.create_tag()
tag_image(image2tag)
@ -215,11 +217,11 @@ def main(site):
# Case: All images tagged
if not site_complete:
if i == 0:
print(site + ": " + str(i) + " images tagged")
print(str(i) + " images tagged\n")
elif image2tag.tide:
print(site + ": " + str(i) + " images tagged with tide")
print(str(i) + " images tagged with tide\n")
else:
print(site + ": " + str(i) + " images tagged no tide")
print(str(i) + " images tagged no tide\n")
#-----------------------------------------------------------------------------#
# Case: Tag reregistered images
@ -264,6 +266,7 @@ else:
main(args.site)
else: # Case 2: No site specified. Tag all images
for site in site_list: # Code to loop over entire images directory: for site in os.listdir(images_dir):
print(site)
main(site)

Loading…
Cancel
Save