aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Garlick <pgarlick@tourbillion-technology.com>2020-07-10 14:48:40 +0100
committerPaul Garlick <pgarlick@tourbillion-technology.com>2020-07-10 14:48:40 +0100
commitb9c022523dfb171e26541aca5bbee4910f67abb5 (patch)
tree89b3fab2634c9397a0ce2115c387c1924561c6d8
parentebba7a48fa412198bd4c82818799e2e3b559c4c2 (diff)
downloadfullSWOF-utils-b9c022523dfb171e26541aca5bbee4910f67abb5.tar.gz
python: slope.py: Use cell size in format function.
* python/slope.py (save_xyz)[PX]: New argument.
-rwxr-xr-xpython/slope.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/python/slope.py b/python/slope.py
index da6d314..817315d 100755
--- a/python/slope.py
+++ b/python/slope.py
@@ -181,13 +181,17 @@ def plot_curve(MY, PX):
#fig.canvas.draw()
#fig.canvas.flush_events()
-def save_xyz():
+def save_xyz(PX):
+ """
+ Write channel elevation data to file. Pixel size PX is used to
+ convert pixel indices to co-ordinate values.
+ """
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(0.25+xitem*0.5,
- 499.75-yitem*0.5,
+ f.write('{:.2f} {:.2f} {:.4f}\n'.format(PX/2.0+xitem*PX,
+ 499.75-yitem*PX,
zitem))
@@ -214,6 +218,6 @@ while (True):
elif(input_str == "p"):
plot_curve(ytp[-1], DY)
elif(input_str == "s"):
- save_xyz()
+ save_xyz(DY)
#print("End.")