aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Garlick <pgarlick@tourbillion-technology.com>2020-07-10 14:55:09 +0100
committerPaul Garlick <pgarlick@tourbillion-technology.com>2020-07-10 14:55:09 +0100
commit3b83f651653db5a172325e00e59edc1e528a3ee4 (patch)
tree0764a06c68ab3fff59e6e113b15142cfb2410925
parentb9c022523dfb171e26541aca5bbee4910f67abb5 (diff)
downloadfullSWOF-utils-3b83f651653db5a172325e00e59edc1e528a3ee4.tar.gz
python: slope.py: Use maximum y-value in format function.
* python/slope.py (save_xyz)[MY]: New argument.
-rwxr-xr-xpython/slope.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/python/slope.py b/python/slope.py
index 817315d..1ce9115 100755
--- a/python/slope.py
+++ b/python/slope.py
@@ -181,18 +181,19 @@ def plot_curve(MY, PX):
#fig.canvas.draw()
#fig.canvas.flush_events()
-def save_xyz(PX):
+def save_xyz(MY, PX):
"""
Write channel elevation data to file. Pixel size PX is used to
- convert pixel indices to co-ordinate values.
+ convert pixel indices to co-ordinate values. The maximum
+ co-ordinate value in the y-direction is MY.
"""
with open('1D.txt', 'w') as f:
for xitem, yitem, zitem in zip(reversed(xch),
reversed(ych),
reversed(zch)):
f.write('{:.2f} {:.2f} {:.4f}\n'.format(PX/2.0+xitem*PX,
- 499.75-yitem*PX,
- zitem))
+ MY-yitem*PX,
+ zitem))
EXIT_COMMAND = "q"
@@ -218,6 +219,6 @@ while (True):
elif(input_str == "p"):
plot_curve(ytp[-1], DY)
elif(input_str == "s"):
- save_xyz(DY)
+ save_xyz(ytp[-1], DY)
#print("End.")