From 047732423715246d86d8e30fa866a8be746e45ee Mon Sep 17 00:00:00 2001 From: Paul Garlick Date: Thu, 10 Feb 2022 17:01:24 +0000 Subject: fullswof-utils: Rename boundary profile script. * fullswof-utils/boundary_profile.py: Move to... * fullswof-utils/boundaryProfile.py: ...here. --- fullswof-utils/boundaryProfile.py | 48 ++++++++++++++++++++++++++++++++++++++ fullswof-utils/boundary_profile.py | 48 -------------------------------------- 2 files changed, 48 insertions(+), 48 deletions(-) create mode 100755 fullswof-utils/boundaryProfile.py delete mode 100755 fullswof-utils/boundary_profile.py (limited to 'fullswof-utils') diff --git a/fullswof-utils/boundaryProfile.py b/fullswof-utils/boundaryProfile.py new file mode 100755 index 0000000..8dee839 --- /dev/null +++ b/fullswof-utils/boundaryProfile.py @@ -0,0 +1,48 @@ +#!/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.xyz" + lineColour = "tab:blue" + plotTitle = 'Top boundary profile' +elif args.location == 'bottom': + inputFilename = "bottom_boundary.xyz" + lineColour = "tab:green" + plotTitle = 'Bottom boundary profile' +elif args.location == 'left': + inputFilename = "left_boundary.xyz" + lineColour = "tab:red" + plotTitle = 'Left boundary profile' +elif args.location == 'right': + inputFilename = "right_boundary.xyz" + lineColour = "tab:orange" + plotTitle = 'Right boundary profile' + +def detach_display(): + x, y, z = np.loadtxt(inputFilename, delimiter=' ', unpack=True) + fig, ax = plt.subplots() + plt.plot(x,z, color=lineColour, label='elevation') + plt.xlabel('x / m') + plt.ylabel('z / m') + plt.title(plotTitle) + ax.yaxis.set_minor_locator(MultipleLocator(0.2)) + plt.grid(True, which='minor') + plt.show() + +if os.fork(): + # parent + pass +else: + # child + detach_display() diff --git a/fullswof-utils/boundary_profile.py b/fullswof-utils/boundary_profile.py deleted file mode 100755 index 8dee839..0000000 --- a/fullswof-utils/boundary_profile.py +++ /dev/null @@ -1,48 +0,0 @@ -#!/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.xyz" - lineColour = "tab:blue" - plotTitle = 'Top boundary profile' -elif args.location == 'bottom': - inputFilename = "bottom_boundary.xyz" - lineColour = "tab:green" - plotTitle = 'Bottom boundary profile' -elif args.location == 'left': - inputFilename = "left_boundary.xyz" - lineColour = "tab:red" - plotTitle = 'Left boundary profile' -elif args.location == 'right': - inputFilename = "right_boundary.xyz" - lineColour = "tab:orange" - plotTitle = 'Right boundary profile' - -def detach_display(): - x, y, z = np.loadtxt(inputFilename, delimiter=' ', unpack=True) - fig, ax = plt.subplots() - plt.plot(x,z, color=lineColour, label='elevation') - plt.xlabel('x / m') - plt.ylabel('z / m') - plt.title(plotTitle) - ax.yaxis.set_minor_locator(MultipleLocator(0.2)) - plt.grid(True, which='minor') - plt.show() - -if os.fork(): - # parent - pass -else: - # child - detach_display() -- cgit