Skip to content

Commit

Permalink
add logs metadata & prints for extract shoreline
Browse files Browse the repository at this point in the history
  • Loading branch information
2320sharon committed Sep 27, 2023
1 parent 3fc43fd commit ef8eb5b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/coastseg/coastseg_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from datetime import datetime
from collections import defaultdict
from typing import Collection, Dict, List, Optional, Tuple, Union
import traceback

# Third-party imports
import pandas as pd
Expand Down Expand Up @@ -1239,17 +1240,19 @@ def extract_shoreline_for_roi(
logger.info(f"extracted_shoreline_dict[{roi_id}]: {extracted_shorelines}")
return extracted_shorelines
except exceptions.Id_Not_Found as id_error:
logger.warning(f"exceptions.Id_Not_Found {id_error}")
logger.warning(
f"exceptions.Id_Not_Found {id_error} {traceback.format_exc()}"
)
print(f"ROI with id {roi_id} was not found. \n Skipping to next ROI")
except exceptions.No_Extracted_Shoreline as no_shoreline:
logger.warning(f"{roi_id}: {no_shoreline}")
logger.warning(f"{roi_id}: {no_shoreline} {traceback.format_exc()}")
print(f"{roi_id}: {no_shoreline}")
except Exception as e:
logger.warning(
f"Exception occurred while extracting shoreline for ROI {roi_id}: {e}"
f"An error occurred while extracting shoreline for ROI {roi_id}: {e} \n {traceback.format_exc()}"
)
print(
f"An error occurred while extracting shoreline for ROI {roi_id}. \n Skipping to next ROI"
f"An error occurred while extracting shoreline for ROI {roi_id}. \n Skipping to next ROI \n {e} \n {traceback.format_exc()}"
)
return None

Expand Down
2 changes: 2 additions & 0 deletions src/coastseg/extracted_shoreline.py
Original file line number Diff line number Diff line change
Expand Up @@ -1579,7 +1579,9 @@ def extract_shorelines(

# filter out files that were removed from RGB directory
try:
logger.info(f"metadata before filter : {metadata}")
metadata = common.filter_metadata(metadata, sitename, filepath_data)
logger.info(f"metadata after filter : {metadata}")
except FileNotFoundError as e:
logger.warning(f"No RGB files existed so no metadata.")
return {}
Expand Down

0 comments on commit ef8eb5b

Please sign in to comment.