Last active
August 24, 2021 18:24
-
-
Save lmeulen/66d23219ab89558a64b422cd1545d41d to your computer and use it in GitHub Desktop.
gpx_elevantion_v1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
df.loc[0, 'delev'] = 0.0 | |
for i in range(1, len(df)): | |
df.loc[i, 'delev'] = (df.loc[i, 'elevation'] - df.loc[i-1, 'elevation']) | |
descent = abs(df['delev'].where(df['delev']<0).sum()) | |
ascent = df['delev'].where(df['delev']>0).sum() | |
minelev = df['elevation'].min() | |
maxelev = df['elevation'].max() | |
print('Minimum elevation : {:4.0f} m'.format(minelev)) | |
print('Maximum elevation : {:4.0f} m'.format(maxelev)) | |
print('Total ascent : {:4.0f} m'.format(ascent)) | |
print('Total descent : {:4.0f} m'.format(descent)) | |
''' | |
Output: | |
Minimum elevation : 13 m | |
Maximum elevation : 68 m | |
Total ascent : 154 m | |
Total descent : 159 m | |
''' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment