diff --git a/outputs_2017088_Survey2.py b/outputs_2017088_Survey2.py index ee9d088..661d0b3 100644 --- a/outputs_2017088_Survey2.py +++ b/outputs_2017088_Survey2.py @@ -11,6 +11,7 @@ #export pngs of the surveys ########################### IMPORTS ########################################### import os +import io import subprocess import pandas as pd import numpy as np @@ -163,16 +164,19 @@ def update_survey_output(df, output_dir): # Merge current survey with existing data profiles = df['Profile'].unique() for profile in profiles: - csv_name = os.path.join(output_dir, profile + '.csv') + csv_name = os.path.join(output_csv_dir, profile + '.csv') + + # Extract survey data for current profile + current_profile = df[df['Profile'] == profile] try: # Load existing results master = pd.read_csv(csv_name) except FileNotFoundError: - master = df.copy() + master = current_profile.copy() # Add (or update) current survey current_survey_col = df.columns[-1] - master[current_survey_col] = df[current_survey_col] + master[current_survey_col] = current_profile[current_survey_col] # Export updated results master.to_csv(csv_name) diff --git a/parse_stdout.py b/parse_stdout.py index 875a751..659c0c0 100644 --- a/parse_stdout.py +++ b/parse_stdout.py @@ -79,15 +79,18 @@ def update_survey_output(df, output_dir): profiles = df['Profile'].unique() for profile in profiles: csv_name = os.path.join(output_csv_dir, profile + '.csv') + + # Extract survey data for current profile + current_profile = df[df['Profile'] == profile] try: # Load existing results master = pd.read_csv(csv_name) except FileNotFoundError: - master = df.copy() + master = current_profile.copy() # Add (or update) current survey current_survey_col = df.columns[-1] - master[current_survey_col] = df[current_survey_col] + master[current_survey_col] = current_profile[current_survey_col] # Export updated results master.to_csv(csv_name) @@ -95,3 +98,10 @@ def update_survey_output(df, output_dir): df = extract_pts(las_in, cp_in, survey_date, keep_only_ground=True) update_survey_output(df, output_csv_dir) + + +master.shape + +current_profile.shape + +df.shape