From 3cec64493a616a0f439f2f67589010ed8a19b977 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 22 Jun 2023 16:39:36 +1000 Subject: [PATCH] minor changes --- coastsnap/images_snapshot.py | 2 +- coastsnap/tag_registered.py | 25 ++++++++++++++----------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/coastsnap/images_snapshot.py b/coastsnap/images_snapshot.py index f6487d8..c41ff99 100644 --- a/coastsnap/images_snapshot.py +++ b/coastsnap/images_snapshot.py @@ -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] diff --git a/coastsnap/tag_registered.py b/coastsnap/tag_registered.py index 7e9ff5a..cc05061 100644 --- a/coastsnap/tag_registered.py +++ b/coastsnap/tag_registered.py @@ -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) + if isinstance(tides_df, pd.DataFrame): # Check if tide data exists + image2tag.get_tide(tides_df) 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) + 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)