Skip to content

Commit

Permalink
#198 load shorelines even if date col already str
Browse files Browse the repository at this point in the history
  • Loading branch information
2320sharon committed Oct 26, 2023
1 parent 68dcb2c commit 32384c2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
21 changes: 17 additions & 4 deletions src/coastseg/coastseg_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -2280,13 +2280,26 @@ def update_loadable_shorelines(self, selected_id: str):
# if extracted shorelines exist, load them onto map, if none exist nothing loads
if hasattr(extracted_shorelines, "gdf"):
if not extracted_shorelines.gdf.empty:
self.extract_shorelines_container.load_list = (
extracted_shorelines.gdf["satname"]
+ "_"
+ extracted_shorelines.gdf["date"].apply(
if extracted_shorelines.gdf["date"].dtype == "object":
# If the "date" column is already of string type, concatenate directly
formatted_dates = extracted_shorelines.gdf["date"]
else:
# If the "date" column is not of string type, convert to string with the required format
formatted_dates = extracted_shorelines.gdf["date"].apply(
lambda x: x.strftime("%Y-%m-%d %H:%M:%S")
)

self.extract_shorelines_container.load_list = (
extracted_shorelines.gdf["satname"] + "_" + formatted_dates
).tolist()
# if not extracted_shorelines.gdf.empty:
# self.extract_shorelines_container.load_list = (
# extracted_shorelines.gdf["satname"]
# + "_"
# + extracted_shorelines.gdf["date"].apply(
# lambda x: x.strftime("%Y-%m-%d %H:%M:%S")
# )
# ).tolist()
else:
return None
return extracted_shorelines
Expand Down
1 change: 0 additions & 1 deletion src/coastseg/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,6 @@ def update_extracted_shorelines_dict_transects_dict(
selected_indexes = get_selected_indexes(
extracted_shorelines_dict, dates_list, sat_list
)
print("selected_indexes", selected_indexes)
# attempt to delete the selected indexes from the "transect_cross_distances.json"
transect_cross_distances_path = os.path.join(
session_path, "transects_cross_distances.json"
Expand Down

0 comments on commit 32384c2

Please sign in to comment.