Skip to content

Commit

Permalink
sort the transect ids columns in raw_transect_time_series.csv
Browse files Browse the repository at this point in the history
  • Loading branch information
2320sharon committed Nov 8, 2024
1 parent bda1a14 commit 2af3eea
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/coastseg/coastseg_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -1840,6 +1840,8 @@ def extract_all_shorelines(self,roi_ids:list=None) -> None:
Returns:
None
"""
if isinstance(roi_ids, str):
roi_ids = [roi_ids]
# 1. validate the inputs for shoreline extraction exist: ROIs, transects,shorelines and a downloaded data for each ROI
self.validate_extract_shoreline_inputs(roi_ids)

Expand Down
5 changes: 5 additions & 0 deletions src/coastseg/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -1921,8 +1921,13 @@ def save_transects(
filepath = os.path.join(save_location, "raw_transect_time_series_merged.csv")
merged_timeseries_df.to_csv(filepath, sep=",",index=False)

# sort the columns
sorted_columns = [timeseries_df.columns[0]] + sorted(timeseries_df.columns[1:], key=lambda x: int(''.join(filter(str.isdigit, x))))
timeseries_df = timeseries_df[sorted_columns]

filepath = os.path.join(save_location, "raw_transect_time_series.csv")
timeseries_df.to_csv(filepath, sep=",",index=False)

# save transect settings to file
transect_settings = get_transect_settings(settings)
transect_settings_path = os.path.join(save_location, "transects_settings.json")
Expand Down

0 comments on commit 2af3eea

Please sign in to comment.