diff options
-rwxr-xr-x | makeBoundary.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/makeBoundary.py b/makeBoundary.py index 9b9e5e2..f71ef8c 100755 --- a/makeBoundary.py +++ b/makeBoundary.py @@ -4,6 +4,7 @@ import matplotlib.pyplot as plt import numpy as np import bisect import ast +import math #TODO: use YAML/ruamel.yaml for configuration file. def read_definition(filename): @@ -37,7 +38,14 @@ height_data = definition_dict["height_data"] # topography # print('gradient =', m, 'intercept =', c) with open(height_data, "r") as topo: - xin, yin, zin = np.loadtxt(topo, delimiter=' ', unpack=True) + xtp, ytp, ztp = np.loadtxt(topo, delimiter=' ', unpack=True) + +# number of cells in x direction +ncols = int(math.sqrt(len(xtp)*(xtp[0]+xtp[-1])/(ytp[0]+ytp[-1]))) +# number of cells in y direction +nrows = int(len(xtp)/ncols) + +print(ncols, nrows) # array index and co-ordinates are related by: # index = (co-ord - 0.25)*2 |