From 8df96d05a4e1d10a6f43ba538d2608537c5192bf Mon Sep 17 00:00:00 2001 From: Paul Garlick Date: Thu, 18 Jun 2020 10:55:26 +0100 Subject: 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. --- python/makeBoundary | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'python/makeBoundary') 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)] -- cgit