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 /python | |
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.
Diffstat (limited to 'python')
-rwxr-xr-x | python/makeBoundary | 12 |
1 files changed, 12 insertions, 0 deletions
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)] |