From 1f18c6f43b3c41537548e8c01b0a6fa58bd51f21 Mon Sep 17 00:00:00 2001 From: Paul Garlick Date: Fri, 10 Jul 2020 10:44:19 +0100 Subject: python: slope.py: Rename co-ordinate variables. * python/slope.py (data): Use same names for co-ordinate variables as makeBoundary. --- python/slope.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'python') diff --git a/python/slope.py b/python/slope.py index 03839e5..0bf99b3 100755 --- a/python/slope.py +++ b/python/slope.py @@ -17,18 +17,18 @@ with open('./topography.txt', "r") as data: # data.seek(p) # go back one line # break - x, y, z = np.loadtxt(data, delimiter=' ', unpack=True) + xtp, ytp, ztp = np.loadtxt(data, delimiter=' ', unpack=True) -xmax = (x[0]+x[-1]) # domain extent in x-direction -ymax = (y[0]+y[-1]) # domain extent in y-direction -NXCELL = int(math.sqrt(len(x)*xmax/ymax)) # number of cells in x-direction -NYCELL = int(len(x)/NXCELL) # number of cells in y-direction +xmax = (xtp[0]+xtp[-1]) # domain extent in x-direction +ymax = (ytp[0]+ytp[-1]) # domain extent in y-direction +NXCELL = int(math.sqrt(len(xtp)*xmax/ymax)) # number of cells in x-direction +NYCELL = int(len(xtp)/NXCELL) # number of cells in y-direction # first reshape to 2-D array then rotate by ninety degrees and flip in # vertical direction to conform to FullSWOF indexing convention -x_co = np.flipud(np.rot90(np.reshape(x, (NXCELL,NYCELL)))) # x co-ordinates -y_co = np.flipud(np.rot90(np.reshape(y, (NXCELL,NYCELL)))) # y co-ordinates -elev = np.flipud(np.rot90(np.reshape(z, (NXCELL,NYCELL)))) # elevation map +x_co = np.flipud(np.rot90(np.reshape(xtp, (NXCELL,NYCELL)))) # x co-ordinates +y_co = np.flipud(np.rot90(np.reshape(ytp, (NXCELL,NYCELL)))) # y co-ordinates +elev = np.flipud(np.rot90(np.reshape(ztp, (NXCELL,NYCELL)))) # elevation map # calculate cell size in x and y directions DX = x_co[0,1] - x_co[0,0] -- cgit