diff options
author | Paul Garlick <pgarlick@tourbillion-technology.com> | 2020-07-10 10:44:19 +0100 |
---|---|---|
committer | Paul Garlick <pgarlick@tourbillion-technology.com> | 2020-07-10 10:44:19 +0100 |
commit | 1f18c6f43b3c41537548e8c01b0a6fa58bd51f21 (patch) | |
tree | 0672c782112c49c2534baa242ac2ed74cf6a78c8 /python | |
parent | 6c213c3ccff0effbe36b655782a2b6e7b9e6f907 (diff) | |
download | fullSWOF-utils-1f18c6f43b3c41537548e8c01b0a6fa58bd51f21.tar.gz |
python: slope.py: Rename co-ordinate variables.
* python/slope.py (data): Use same names for co-ordinate variables as
makeBoundary.
Diffstat (limited to 'python')
-rwxr-xr-x | python/slope.py | 16 |
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] |