Tag sites with no tide data

master
unknown 1 year ago
parent dbdaac512a
commit 52b6f1eddd

@ -35,7 +35,7 @@ args = parser.parse_args()
# Retrieve coastsnap/images directory set in coastsnap_sites.csv # Retrieve coastsnap/images directory set in coastsnap_sites.csv
code_images_dir = str(Path(os.getcwd()).parent) code_images_dir = str(Path(os.getcwd()).parent)
sites_csv_path = os.path.join(code_images_dir, "coastsnap_sites.csv") sites_csv_path = os.path.join(code_images_dir, "coastsnap_sites_tag.csv")
coastsnap_sites_csv = pd.read_csv(sites_csv_path) 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")
@ -143,8 +143,6 @@ def main(site):
i=0 i=0
site_complete = False # A flag to stop tagging images when found site_complete = False # A flag to stop tagging images when found
tide_data = False
font = None
image2tag = None image2tag = None
photoshop_path = images_dir +'/'+ site + '/Photoshop' photoshop_path = images_dir +'/'+ site + '/Photoshop'
try: # Check if site contains 'Processed' directory try: # Check if site contains 'Processed' directory
@ -196,10 +194,14 @@ def main(site):
pathname = os.path.join(year_path, image_filename) pathname = os.path.join(year_path, image_filename)
image2tag = RegisteredImage(pathname, image_filename, registered_image_path) # Create image object image2tag = RegisteredImage(pathname, image_filename, registered_image_path) # Create image object
if i == 1: # Retrieve Tide Data once for each site if i == 1: # Retrieve Tide Data once for each site
tides_df = get_site_tide_data(images_parent_dir, site) try:
tides_df = get_site_tide_data(images_parent_dir, site)
except:
print("No tide data for " + site)
image2tag.get_font() image2tag.get_font()
image2tag.get_dimensions() image2tag.get_dimensions()
if isinstance(tides_df, pd.DataFrame): image2tag.get_tide(tides_df) if isinstance(tides_df, pd.DataFrame): # Check if tide data exists
image2tag.get_tide(tides_df)
image2tag.create_tag() image2tag.create_tag()
tag_image(image2tag) tag_image(image2tag)

Loading…
Cancel
Save