diff options
| author | Paul Garlick <pgarlick@tourbillion-technology.com> | 2019-09-30 18:04:55 +0100 | 
|---|---|---|
| committer | Paul Garlick <pgarlick@tourbillion-technology.com> | 2019-09-30 18:04:55 +0100 | 
| commit | eb20e7fe64c40182d68676b7f7b731fca22385a3 (patch) | |
| tree | b371689b2b1478561b7b8191cf33b22efdbefbaa | |
| parent | f76eb53eb43b726f6141f83b849b32591babb36d (diff) | |
| download | fullSWOF-utils-eb20e7fe64c40182d68676b7f7b731fca22385a3.tar.gz | |
add function to read definition file.
| -rwxr-xr-x | makeBoundary.py | 13 | 
1 files changed, 13 insertions, 0 deletions
| diff --git a/makeBoundary.py b/makeBoundary.py index e3d30cb..e1ca2de 100755 --- a/makeBoundary.py +++ b/makeBoundary.py @@ -4,6 +4,19 @@ import matplotlib.pyplot as plt  import numpy as np  import bisect +def read_definition(filename): +    ddict = {} +    with open(filename, "r") as f: +        for line in f: +            items = line.split(': ', 1) +            if len(items) == 2: +                ddict[items[0]] = eval(items[1]) +    return ddict + +definition_dict = read_definition('boundaryDefinition.txt') +for dd in definition_dict: +    print(definition_dict[dd]) +  with open('./1D_top.txt', "r") as data:      xch, ych, zch = np.loadtxt(data, delimiter=' ', unpack=True) | 
