diff options
author | Paul Garlick <pgarlick@tourbillion-technology.com> | 2021-12-17 17:42:27 +0000 |
---|---|---|
committer | Paul Garlick <pgarlick@tourbillion-technology.com> | 2021-12-17 17:42:27 +0000 |
commit | b86da1bea4b8a30a85870f2ad45e621de7679cec (patch) | |
tree | eb4716d9952bea37e2e7f3726ceb76c21d25d43d /fullswof-utils | |
parent | a5780b11b15847c612b4825a111ce447bbeeae97 (diff) | |
download | fullSWOF-utils-b86da1bea4b8a30a85870f2ad45e621de7679cec.tar.gz |
fullswof-utils: Add script for plotting elevation at boundaries.
* fullswof-utils/boundary_profile.py: New file.
Diffstat (limited to 'fullswof-utils')
-rwxr-xr-x | fullswof-utils/boundary_profile.py | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/fullswof-utils/boundary_profile.py b/fullswof-utils/boundary_profile.py new file mode 100755 index 0000000..091db8a --- /dev/null +++ b/fullswof-utils/boundary_profile.py @@ -0,0 +1,39 @@ +#!/usr/bin/env python3 + +import matplotlib.pyplot as plt +import numpy as np +import os +import argparse +from matplotlib.ticker import MultipleLocator + +# read command line argument: +parser = argparse.ArgumentParser( + description="plot elevation versus distance at boundaries") +parser.add_argument("location", help="boundary location") +args = parser.parse_args() + +if args.location == 'top': + inputFilename = "top_boundary.txt" +elif args.location == 'bottom': + inputFilename = "bottom_boundary.txt" +elif args.location == 'left': + inputFilename = "left_boundary.txt" +elif args.location == 'right': + inputFilename = "right_boundary.txt" + +def detach_display(): + x, y, z = np.loadtxt(inputFilename, delimiter=' ', unpack=True) + fig, ax = plt.subplots() + plt.plot(x,z, label='elevation') + plt.xlabel('x / m') + plt.ylabel('z / m') + ax.yaxis.set_minor_locator(MultipleLocator(0.2)) + plt.grid(True, which='minor') + plt.show() + +if os.fork(): + # parent + pass +else: + # child + detach_display() |