Skip to content

Commit

Permalink
add comments and type hints
Browse files Browse the repository at this point in the history
  • Loading branch information
2320sharon committed Nov 29, 2023
1 parent 1eb047e commit 4208481
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/coastseg/coastseg_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions src/coastseg/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
):
Expand Down

0 comments on commit 4208481

Please sign in to comment.