Separate surveys into profiles

etta-drone
Dan Howe 7 years ago
parent 4e80a3d86e
commit 82f0aea7ed

@ -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)

@ -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

Loading…
Cancel
Save