diff --git a/coastsnap/tag_registered.py b/coastsnap/tag_registered.py index 1d756f4..7e9ff5a 100644 --- a/coastsnap/tag_registered.py +++ b/coastsnap/tag_registered.py @@ -35,7 +35,7 @@ args = parser.parse_args() # Retrieve coastsnap/images directory set in coastsnap_sites.csv 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) images_parent_dir = coastsnap_sites_csv.parent_directory[0] images_dir = os.path.join(images_parent_dir, "Images") @@ -143,8 +143,6 @@ def main(site): i=0 site_complete = False # A flag to stop tagging images when found - tide_data = False - font = None image2tag = None photoshop_path = images_dir +'/'+ site + '/Photoshop' try: # Check if site contains 'Processed' directory @@ -196,10 +194,14 @@ def main(site): pathname = os.path.join(year_path, image_filename) image2tag = RegisteredImage(pathname, image_filename, registered_image_path) # Create image object 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_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() tag_image(image2tag)