From cc2587b14535a4db84ae227720c7a8b603e8986b Mon Sep 17 00:00:00 2001 From: Dan Howe Date: Mon, 30 Jul 2018 08:58:21 +1000 Subject: [PATCH] Fix bug with volume calculations on different dates --- las_outputs.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/las_outputs.py b/las_outputs.py index 8746ac0..defa76c 100644 --- a/las_outputs.py +++ b/las_outputs.py @@ -160,17 +160,17 @@ def calculate_volumes(profile_name, survey_date, csv_output_dir, ch_limits, volu # Create new dataframe if csv does not exist volumes = pd.DataFrame() - for current_date in profiles.columns: - # Get Nielsen erosion volumes - chainage = profiles.loc[:, current_date].dropna().index - elevation = profiles.loc[:, current_date].dropna().values - try: - volume = nielsen_volumes.volume_available(chainage, elevation, ch_min) - except ValueError: - volume = np.nan + # Get Nielsen erosion volumes for current survey date + current_survey = 'Elevation_' + survey_date + chainage = profiles.loc[:, current_survey].dropna().index + elevation = profiles.loc[:, current_survey].dropna().values + try: + volume = nielsen_volumes.volume_available(chainage, elevation, ch_min) + except ValueError: + volume = np.nan - # Update spreadsheet - volumes.loc[profile_name, 'Volume_' + survey_date] = volume + # Update spreadsheet + volumes.loc[profile_name, 'Volume_' + survey_date] = volume # Save updated volumes spreadsheet volumes = volumes[volumes.columns.sort_values()]