aboutsummaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rwxr-xr-xpython/slope.py16
1 files changed, 8 insertions, 8 deletions
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]