diff --git a/src/coastseg/coastseg_map.py b/src/coastseg/coastseg_map.py index c58c09ea..f7b627eb 100644 --- a/src/coastseg/coastseg_map.py +++ b/src/coastseg/coastseg_map.py @@ -118,7 +118,7 @@ def find_shorelines_directory(path, roi_id): return None -def delete_extracted_shorelines_files(session_path, selected_items): +def delete_extracted_shorelines_files(session_path:str, selected_items:List): """Delete the extracted shorelines from the session directory for all the relevant files Removes the extracted shorelines from the following files: - extracted_shorelines_lines.geojson @@ -164,7 +164,7 @@ def delete_extracted_shorelines_files(session_path, selected_items): file_patterns = ["_timeseries_tidally_corrected", "_timeseries_raw.csv"] for file_pattern in file_patterns: common.drop_rows_from_csv(file_pattern, session_path, dates_list) - # delete the extracted shorelines from the jpg deterction files + # delete the extracted shorelines from the jpg detection files jpg_path = os.path.join(session_path, "jpg_files", "detection") if os.path.exists(jpg_path) and os.path.isdir(jpg_path): common.delete_jpg_files(dates_list, sat_list, jpg_path) diff --git a/src/coastseg/common.py b/src/coastseg/common.py index 00d0d267..5d4e7b70 100644 --- a/src/coastseg/common.py +++ b/src/coastseg/common.py @@ -212,7 +212,9 @@ def update_extracted_shorelines_dict_transects_dict( ): json_file = os.path.join(session_path, filename) if os.path.exists(json_file) and os.path.isfile(json_file): + # read the data from the json file data = file_utilities.load_data_from_json(json_file) + # processes the data into nested arrays extracted_shorelines_dict = process_data_input(data) if extracted_shorelines_dict is not None: # Get the indexes of the selected items in the extracted_shorelines_dict @@ -223,6 +225,7 @@ def update_extracted_shorelines_dict_transects_dict( transect_cross_distances_path = os.path.join( session_path, "transects_cross_distances.json" ) + # if the transect_cross_distances.json exists then delete the selected indexes from it if os.path.exists(transect_cross_distances_path) and os.path.isfile( transect_cross_distances_path ):