diff --git a/survey_tools.py b/survey_tools.py index c9eec31..b9e2548 100644 --- a/survey_tools.py +++ b/survey_tools.py @@ -143,7 +143,7 @@ def update_survey_output(df, output_dir): output_dir: directory where csv files are saved Returns: - None + True if current survey is latest, otherwise False """ # Merge current survey with existing data profiles = df['Profile'].unique() @@ -168,5 +168,10 @@ def update_survey_output(df, output_dir): except FileExistsError: pass + # Ensure survey dates are in correct order + elev_cols = sorted([col for col in master.columns if 'Elevation' in col]) + other_cols = [col for col in master.columns if 'Elevation' not in col] + master = master[other_cols + elev_cols] + # Export updated results master.to_csv(csv_name, index=False)