From 141ad9a7c993ee0b26633962e16cadff73310c00 Mon Sep 17 00:00:00 2001 From: Sharon Fitzpatrick Date: Thu, 4 Apr 2024 09:39:35 -0700 Subject: [PATCH] add remove_existing imagery filter to check_images_available --- src/coastsat/SDS_download.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/coastsat/SDS_download.py b/src/coastsat/SDS_download.py index f6cae83..f424f24 100644 --- a/src/coastsat/SDS_download.py +++ b/src/coastsat/SDS_download.py @@ -1315,6 +1315,16 @@ def check_images_available(inputs,months_list=None,prc_cloud_cover=95): sum_img = sum_img + len(im_list) print(" %s: %d images" % (satname, len(im_list))) im_dict_T1[satname] += im_list + + # if the directory already exists, remove the images that already exist + filepath = os.path.join(inputs['filepath'],inputs['sitename']) + if os.path.exists(filepath): + # get the metadata and satellites that need to be filtered + sat_list = inputs["sat_list"] + metadata = get_metadata(inputs) + # remove any images that already exist from im_dict_T1 because they've already been downloaded + im_dict_T1 = remove_existing_imagery(im_dict_T1, metadata,sat_list) + # if only S2 is in sat_list, stop here as no Tier 2 for Sentinel if len(inputs["sat_list"]) == 1 and inputs["sat_list"][0] == "S2": return im_dict_T1, []