Reverse chainages so elevations are monotonically increasing

master
Dan Howe 5 years ago
parent 061805791a
commit b014a14168

@ -40,14 +40,17 @@ for beach in beaches:
survey = df.loc[(beach, block, profile, date), :] survey = df.loc[(beach, block, profile, date), :]
survey = survey.set_index('Chainage') survey = survey.set_index('Chainage')
# Find last point in profile above ref contour elevation # Reverse survey chainage for interpolation
last_idx = survey.where( survey = survey[::-1]
survey['Elevation'] > contour_z).last_valid_index()
elevation = survey.loc[last_idx:, 'Elevation'] # Find largest chainage in profile above contour elevation
eastings = survey.loc[last_idx:, 'Easting'] idx = survey.where(
northings = survey.loc[last_idx:, 'Northing'] survey['Elevation'] > contour_z).first_valid_index()
x.append(np.interp(contour_z, elevation, eastings)) elevation = survey.loc[:idx, 'Elevation']
y.append(np.interp(contour_z, elevation, northings)) eastings = survey.loc[:idx, 'Easting']
northings = survey.loc[:idx, 'Northing']
x = np.interp(contour_z, elevation, eastings)
y = np.interp(contour_z, elevation, northings)
except KeyError: except KeyError:
pass pass

Loading…
Cancel
Save