diff options
author | Paul Garlick <pgarlick@tourbillion-technology.com> | 2020-06-18 10:55:26 +0100 |
---|---|---|
committer | Paul Garlick <pgarlick@tourbillion-technology.com> | 2020-06-18 10:55:26 +0100 |
commit | 8df96d05a4e1d10a6f43ba538d2608537c5192bf (patch) | |
tree | 7d04cb57e8e163c09f4f44da2ca0a134f9938cc3 | |
parent | 946d73283475036ad59baeef2fabdefdaf720a62 (diff) | |
download | fullSWOF-utils-8df96d05a4e1d10a6f43ba538d2608537c5192bf.tar.gz |
python: Enable writing rating curve data to file.
* python/makeBoundary: Add 'printing' definition.
demo/boundaryBottom.txt: Add 'printing' parameter.
demo/boundaryTop.txt: Add 'printing' parameter.
-rw-r--r-- | demo/boundaryBottom.txt | 3 | ||||
-rw-r--r-- | demo/boundaryTop.txt | 3 | ||||
-rwxr-xr-x | python/makeBoundary | 12 |
3 files changed, 18 insertions, 0 deletions
diff --git a/demo/boundaryBottom.txt b/demo/boundaryBottom.txt index c06623e..71389e7 100644 --- a/demo/boundaryBottom.txt +++ b/demo/boundaryBottom.txt @@ -8,6 +8,9 @@ type: 1 # Enable plotting (True or False): plotting: False +# Enable printing (True or False): +printing: False + # Local gradient: slope: -0.003646 diff --git a/demo/boundaryTop.txt b/demo/boundaryTop.txt index ebcb5f7..789a6e3 100644 --- a/demo/boundaryTop.txt +++ b/demo/boundaryTop.txt @@ -8,6 +8,9 @@ type: 5 # Enable plotting (True or False): plotting: True +# Enable printing (True or False): +printing: False + # Local gradient: slope: -0.003646 diff --git a/python/makeBoundary b/python/makeBoundary index 3684faf..f2f8840 100755 --- a/python/makeBoundary +++ b/python/makeBoundary @@ -146,6 +146,7 @@ btype = definition_dict["type"] # boundary type (1--5) slope = abs(definition_dict["slope"]) # slope at top boundary target_flow = definition_dict["target_flow"] # imposed discharge plotting = definition_dict["plotting"] # enable or disable plotting +printing = definition_dict["printing"] # enable or disable printing n_co = definition_dict["n_co"] # Manning's 'n' coefficients # TODO: use weighted mean 'n' values. See # http://help.floodmodeller.com/isis/ISIS/River_Section.htm (Eq. 4) @@ -275,6 +276,17 @@ for p in range(num_panels): K_i[p], r'conveyance / $m^3/s$', Q_i[p], r'discharge / $m^3/s$', 'Panel {}'.format(p)) + if printing: + ratingCurveFileName = 'panel{}_{}.dat'.format(p,args.location) + with open(ratingCurveFileName, 'w') as f: + f.write('{:16} {:18} {:12} {:10}\n'.format( + '#maximum depth', 'hydraulic radius', + 'conveyance', 'discharge')) + f.write('{:16} {:18} {:12} {:10}\n'.format( + '#/ m', '/ m', '/ m^3/s', '/ m^3/s')) + for h in range(numH): + f.write('{:7.6f} {:16.6f} {:19.6f} {:11.6f}\n'.format( + h_i[p][h]-zmin[p],r_h[p][h],K_i[p][h],Q_i[p][h])) else: p_i[p], A_i[p], r_h[p], h_i[p], K_i[p], Q_i[p] = [ [0] * numH for _ in range(6)] |