floodmodeller-api 0.4.2__py3-none-any.whl → 0.4.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- floodmodeller_api/__init__.py +8 -9
- floodmodeller_api/_base.py +184 -176
- floodmodeller_api/backup.py +273 -273
- floodmodeller_api/dat.py +909 -838
- floodmodeller_api/diff.py +136 -119
- floodmodeller_api/ied.py +307 -311
- floodmodeller_api/ief.py +647 -646
- floodmodeller_api/ief_flags.py +253 -253
- floodmodeller_api/inp.py +266 -268
- floodmodeller_api/libs/libifcoremd.dll +0 -0
- floodmodeller_api/libs/libifcoremt.so.5 +0 -0
- floodmodeller_api/libs/libifport.so.5 +0 -0
- floodmodeller_api/{libmmd.dll → libs/libimf.so} +0 -0
- floodmodeller_api/libs/libintlc.so.5 +0 -0
- floodmodeller_api/libs/libmmd.dll +0 -0
- floodmodeller_api/libs/libsvml.so +0 -0
- floodmodeller_api/libs/libzzn_read.so +0 -0
- floodmodeller_api/libs/zzn_read.dll +0 -0
- floodmodeller_api/logs/__init__.py +2 -2
- floodmodeller_api/logs/lf.py +320 -314
- floodmodeller_api/logs/lf_helpers.py +354 -346
- floodmodeller_api/logs/lf_params.py +643 -529
- floodmodeller_api/mapping.py +84 -0
- floodmodeller_api/test/__init__.py +4 -4
- floodmodeller_api/test/conftest.py +9 -8
- floodmodeller_api/test/test_backup.py +117 -117
- floodmodeller_api/test/test_dat.py +221 -92
- floodmodeller_api/test/test_data/All Units 4_6.DAT +1081 -1081
- floodmodeller_api/test/test_data/All Units 4_6.feb +1081 -1081
- floodmodeller_api/test/test_data/BRIDGE.DAT +926 -926
- floodmodeller_api/test/test_data/Culvert_Inlet_Outlet.dat +36 -36
- floodmodeller_api/test/test_data/Culvert_Inlet_Outlet.feb +36 -36
- floodmodeller_api/test/test_data/DamBreakADI.xml +52 -52
- floodmodeller_api/test/test_data/DamBreakFAST.xml +58 -58
- floodmodeller_api/test/test_data/DamBreakFAST_dy.xml +53 -53
- floodmodeller_api/test/test_data/DamBreakTVD.xml +55 -55
- floodmodeller_api/test/test_data/DefenceBreach.xml +53 -53
- floodmodeller_api/test/test_data/DefenceBreachFAST.xml +60 -60
- floodmodeller_api/test/test_data/DefenceBreachFAST_dy.xml +55 -55
- floodmodeller_api/test/test_data/Domain1+2_QH.xml +76 -76
- floodmodeller_api/test/test_data/Domain1_H.xml +41 -41
- floodmodeller_api/test/test_data/Domain1_Q.xml +41 -41
- floodmodeller_api/test/test_data/Domain1_Q_FAST.xml +48 -48
- floodmodeller_api/test/test_data/Domain1_Q_FAST_dy.xml +48 -48
- floodmodeller_api/test/test_data/Domain1_Q_xml_expected.json +263 -0
- floodmodeller_api/test/test_data/Domain1_W.xml +41 -41
- floodmodeller_api/test/test_data/EX1.DAT +321 -321
- floodmodeller_api/test/test_data/EX1.ext +107 -107
- floodmodeller_api/test/test_data/EX1.feb +320 -320
- floodmodeller_api/test/test_data/EX1.gxy +107 -107
- floodmodeller_api/test/test_data/EX17.DAT +421 -422
- floodmodeller_api/test/test_data/EX17.ext +213 -213
- floodmodeller_api/test/test_data/EX17.feb +422 -422
- floodmodeller_api/test/test_data/EX18.DAT +375 -375
- floodmodeller_api/test/test_data/EX18_DAT_expected.json +3876 -0
- floodmodeller_api/test/test_data/EX2.DAT +302 -302
- floodmodeller_api/test/test_data/EX3.DAT +926 -926
- floodmodeller_api/test/test_data/EX3_DAT_expected.json +16235 -0
- floodmodeller_api/test/test_data/EX3_IEF_expected.json +61 -0
- floodmodeller_api/test/test_data/EX6.DAT +2084 -2084
- floodmodeller_api/test/test_data/EX6.ext +532 -532
- floodmodeller_api/test/test_data/EX6.feb +2084 -2084
- floodmodeller_api/test/test_data/EX6_DAT_expected.json +31647 -0
- floodmodeller_api/test/test_data/Event Data Example.DAT +336 -336
- floodmodeller_api/test/test_data/Event Data Example.ext +107 -107
- floodmodeller_api/test/test_data/Event Data Example.feb +336 -336
- floodmodeller_api/test/test_data/Linked1D2D.xml +52 -52
- floodmodeller_api/test/test_data/Linked1D2DFAST.xml +53 -53
- floodmodeller_api/test/test_data/Linked1D2DFAST_dy.xml +48 -48
- floodmodeller_api/test/test_data/Linked1D2D_xml_expected.json +313 -0
- floodmodeller_api/test/test_data/blockage.dat +50 -50
- floodmodeller_api/test/test_data/blockage.ext +45 -45
- floodmodeller_api/test/test_data/blockage.feb +9 -9
- floodmodeller_api/test/test_data/blockage.gxy +71 -71
- floodmodeller_api/test/test_data/defaultUnits.dat +127 -127
- floodmodeller_api/test/test_data/defaultUnits.ext +45 -45
- floodmodeller_api/test/test_data/defaultUnits.feb +9 -9
- floodmodeller_api/test/test_data/defaultUnits.fmpx +58 -58
- floodmodeller_api/test/test_data/defaultUnits.gxy +85 -85
- floodmodeller_api/test/test_data/ex3.ief +20 -20
- floodmodeller_api/test/test_data/ex3.lf1 +2800 -2800
- floodmodeller_api/test/test_data/ex4.DAT +1374 -1374
- floodmodeller_api/test/test_data/ex4_changed.DAT +1374 -1374
- floodmodeller_api/test/test_data/example1.inp +329 -329
- floodmodeller_api/test/test_data/example2.inp +158 -158
- floodmodeller_api/test/test_data/example3.inp +297 -297
- floodmodeller_api/test/test_data/example4.inp +388 -388
- floodmodeller_api/test/test_data/example5.inp +147 -147
- floodmodeller_api/test/test_data/example6.inp +154 -154
- floodmodeller_api/test/test_data/jump.dat +176 -176
- floodmodeller_api/test/test_data/network.dat +1374 -1374
- floodmodeller_api/test/test_data/network.ext +45 -45
- floodmodeller_api/test/test_data/network.exy +1 -1
- floodmodeller_api/test/test_data/network.feb +45 -45
- floodmodeller_api/test/test_data/network.ied +45 -45
- floodmodeller_api/test/test_data/network.ief +20 -20
- floodmodeller_api/test/test_data/network.inp +147 -147
- floodmodeller_api/test/test_data/network.pxy +57 -57
- floodmodeller_api/test/test_data/network.zzd +122 -122
- floodmodeller_api/test/test_data/network_dat_expected.json +21837 -0
- floodmodeller_api/test/test_data/network_from_tabularCSV.csv +87 -87
- floodmodeller_api/test/test_data/network_ied_expected.json +287 -0
- floodmodeller_api/test/test_data/rnweir.dat +9 -9
- floodmodeller_api/test/test_data/rnweir.ext +45 -45
- floodmodeller_api/test/test_data/rnweir.feb +9 -9
- floodmodeller_api/test/test_data/rnweir.gxy +45 -45
- floodmodeller_api/test/test_data/rnweir_default.dat +74 -74
- floodmodeller_api/test/test_data/rnweir_default.ext +45 -45
- floodmodeller_api/test/test_data/rnweir_default.feb +9 -9
- floodmodeller_api/test/test_data/rnweir_default.fmpx +58 -58
- floodmodeller_api/test/test_data/rnweir_default.gxy +53 -53
- floodmodeller_api/test/test_data/unit checks.dat +16 -16
- floodmodeller_api/test/test_ied.py +29 -29
- floodmodeller_api/test/test_ief.py +125 -24
- floodmodeller_api/test/test_inp.py +47 -48
- floodmodeller_api/test/test_json.py +114 -0
- floodmodeller_api/test/test_logs_lf.py +48 -51
- floodmodeller_api/test/test_tool.py +165 -154
- floodmodeller_api/test/test_toolbox_structure_log.py +234 -239
- floodmodeller_api/test/test_xml2d.py +151 -156
- floodmodeller_api/test/test_zzn.py +36 -34
- floodmodeller_api/to_from_json.py +218 -0
- floodmodeller_api/tool.py +332 -330
- floodmodeller_api/toolbox/__init__.py +5 -5
- floodmodeller_api/toolbox/example_tool.py +45 -45
- floodmodeller_api/toolbox/model_build/__init__.py +2 -2
- floodmodeller_api/toolbox/model_build/add_siltation_definition.py +100 -94
- floodmodeller_api/toolbox/model_build/structure_log/__init__.py +1 -1
- floodmodeller_api/toolbox/model_build/structure_log/structure_log.py +287 -289
- floodmodeller_api/toolbox/model_build/structure_log_definition.py +76 -72
- floodmodeller_api/units/__init__.py +10 -10
- floodmodeller_api/units/_base.py +214 -209
- floodmodeller_api/units/boundaries.py +467 -469
- floodmodeller_api/units/comment.py +52 -55
- floodmodeller_api/units/conduits.py +382 -403
- floodmodeller_api/units/helpers.py +123 -132
- floodmodeller_api/units/iic.py +107 -101
- floodmodeller_api/units/losses.py +305 -308
- floodmodeller_api/units/sections.py +444 -445
- floodmodeller_api/units/structures.py +1690 -1684
- floodmodeller_api/units/units.py +93 -102
- floodmodeller_api/units/unsupported.py +44 -44
- floodmodeller_api/units/variables.py +87 -89
- floodmodeller_api/urban1d/__init__.py +11 -11
- floodmodeller_api/urban1d/_base.py +188 -177
- floodmodeller_api/urban1d/conduits.py +93 -85
- floodmodeller_api/urban1d/general_parameters.py +58 -58
- floodmodeller_api/urban1d/junctions.py +81 -79
- floodmodeller_api/urban1d/losses.py +81 -74
- floodmodeller_api/urban1d/outfalls.py +114 -107
- floodmodeller_api/urban1d/raingauges.py +111 -108
- floodmodeller_api/urban1d/subsections.py +92 -93
- floodmodeller_api/urban1d/xsections.py +147 -141
- floodmodeller_api/util.py +77 -21
- floodmodeller_api/validation/parameters.py +660 -660
- floodmodeller_api/validation/urban_parameters.py +388 -404
- floodmodeller_api/validation/validation.py +110 -112
- floodmodeller_api/version.py +1 -1
- floodmodeller_api/xml2d.py +688 -684
- floodmodeller_api/xml2d_template.py +37 -37
- floodmodeller_api/zzn.py +387 -365
- {floodmodeller_api-0.4.2.dist-info → floodmodeller_api-0.4.3.dist-info}/LICENSE.txt +13 -13
- {floodmodeller_api-0.4.2.dist-info → floodmodeller_api-0.4.3.dist-info}/METADATA +82 -82
- floodmodeller_api-0.4.3.dist-info/RECORD +179 -0
- {floodmodeller_api-0.4.2.dist-info → floodmodeller_api-0.4.3.dist-info}/WHEEL +1 -1
- floodmodeller_api-0.4.3.dist-info/entry_points.txt +3 -0
- floodmodeller_api/libifcoremd.dll +0 -0
- floodmodeller_api/test/test_data/EX3.bmp +0 -0
- floodmodeller_api/test/test_data/test_output.csv +0 -87
- floodmodeller_api/zzn_read.dll +0 -0
- floodmodeller_api-0.4.2.data/scripts/fmapi-add_siltation.bat +0 -2
- floodmodeller_api-0.4.2.data/scripts/fmapi-add_siltation.py +0 -3
- floodmodeller_api-0.4.2.data/scripts/fmapi-structure_log.bat +0 -2
- floodmodeller_api-0.4.2.data/scripts/fmapi-structure_log.py +0 -3
- floodmodeller_api-0.4.2.data/scripts/fmapi-toolbox.bat +0 -2
- floodmodeller_api-0.4.2.data/scripts/fmapi-toolbox.py +0 -41
- floodmodeller_api-0.4.2.dist-info/RECORD +0 -169
- {floodmodeller_api-0.4.2.dist-info → floodmodeller_api-0.4.3.dist-info}/top_level.txt +0 -0
|
@@ -1,403 +1,382 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Flood Modeller Python API
|
|
3
|
-
Copyright (C)
|
|
4
|
-
|
|
5
|
-
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License
|
|
6
|
-
as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
|
7
|
-
|
|
8
|
-
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
|
9
|
-
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
10
|
-
|
|
11
|
-
You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.
|
|
12
|
-
|
|
13
|
-
If you have any query about this program or this License, please contact us at support@floodmodeller.com or write to the following
|
|
14
|
-
address: Jacobs UK Limited, Flood Modeller, Cottons Centre, Cottons Lane, London, SE1 2QG, United Kingdom.
|
|
15
|
-
"""
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
from .
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
class
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
"
|
|
156
|
-
"
|
|
157
|
-
"
|
|
158
|
-
"
|
|
159
|
-
"
|
|
160
|
-
"
|
|
161
|
-
"
|
|
162
|
-
"
|
|
163
|
-
"
|
|
164
|
-
"
|
|
165
|
-
"
|
|
166
|
-
"
|
|
167
|
-
"
|
|
168
|
-
"
|
|
169
|
-
"
|
|
170
|
-
"
|
|
171
|
-
"
|
|
172
|
-
"
|
|
173
|
-
"
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
self.
|
|
187
|
-
self.
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
self.
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
self.
|
|
197
|
-
self.
|
|
198
|
-
self.
|
|
199
|
-
self.
|
|
200
|
-
self.
|
|
201
|
-
self.
|
|
202
|
-
self.
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
self.
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
self.
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
self.
|
|
214
|
-
self.
|
|
215
|
-
self.
|
|
216
|
-
self.
|
|
217
|
-
self.
|
|
218
|
-
self.
|
|
219
|
-
self.
|
|
220
|
-
self.
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
self.
|
|
224
|
-
self.
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
self.
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
self.
|
|
232
|
-
self.
|
|
233
|
-
self.
|
|
234
|
-
self.
|
|
235
|
-
self.
|
|
236
|
-
self.
|
|
237
|
-
self.
|
|
238
|
-
self.
|
|
239
|
-
self.
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
self.
|
|
243
|
-
self.
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
self.
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
self.
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
)
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
self.
|
|
297
|
-
self.
|
|
298
|
-
self.
|
|
299
|
-
self.
|
|
300
|
-
self.
|
|
301
|
-
self.
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
self.
|
|
350
|
-
self.
|
|
351
|
-
self.
|
|
352
|
-
self.
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
self.
|
|
356
|
-
self.
|
|
357
|
-
self.
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
self.friction_on_soffit,
|
|
384
|
-
),
|
|
385
|
-
]
|
|
386
|
-
)
|
|
387
|
-
return c_block
|
|
388
|
-
|
|
389
|
-
elif self._subtype == "SECTION":
|
|
390
|
-
c_block.extend(
|
|
391
|
-
[
|
|
392
|
-
join_10_char(self.dist_to_next),
|
|
393
|
-
join_10_char(len(self.coords)),
|
|
394
|
-
]
|
|
395
|
-
)
|
|
396
|
-
for index, coord in self.coords.iterrows():
|
|
397
|
-
c_block.extend(
|
|
398
|
-
[join_10_char(coord.x, coord.y) + join_10_char(coord.cw_friction, dp=6)]
|
|
399
|
-
)
|
|
400
|
-
return c_block
|
|
401
|
-
|
|
402
|
-
else:
|
|
403
|
-
return self._raw_block
|
|
1
|
+
"""
|
|
2
|
+
Flood Modeller Python API
|
|
3
|
+
Copyright (C) 2024 Jacobs U.K. Limited
|
|
4
|
+
|
|
5
|
+
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License
|
|
6
|
+
as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
|
7
|
+
|
|
8
|
+
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
|
9
|
+
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
10
|
+
|
|
11
|
+
You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.
|
|
12
|
+
|
|
13
|
+
If you have any query about this program or this License, please contact us at support@floodmodeller.com or write to the following
|
|
14
|
+
address: Jacobs UK Limited, Flood Modeller, Cottons Centre, Cottons Lane, London, SE1 2QG, United Kingdom.
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
import pandas as pd
|
|
18
|
+
|
|
19
|
+
from floodmodeller_api.validation import _validate_unit
|
|
20
|
+
|
|
21
|
+
from ._base import Unit
|
|
22
|
+
from .helpers import (
|
|
23
|
+
_to_float,
|
|
24
|
+
_to_int,
|
|
25
|
+
_to_str,
|
|
26
|
+
join_10_char,
|
|
27
|
+
join_n_char_ljust,
|
|
28
|
+
split_10_char,
|
|
29
|
+
split_n_char,
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class CONDUIT(Unit):
|
|
34
|
+
"""The Conduit class supports two conduit sub-types in Flood Modeller: RECTANGULAR and CIRCULAR. Each of these sub-types forms
|
|
35
|
+
a unique instance of the class which is differentiated by the `CONDUIT.subtype` attribute. All conduit types have the same common
|
|
36
|
+
attributes:
|
|
37
|
+
|
|
38
|
+
**Common Attributes**
|
|
39
|
+
|
|
40
|
+
Args:
|
|
41
|
+
name (str): Conduit section name
|
|
42
|
+
spill (str): Spill label
|
|
43
|
+
comment (str): Comment included in unit
|
|
44
|
+
dist_to_next (float): Distance to next section in metres
|
|
45
|
+
subtype (str): Defines the type of conduit unit (*Should not be changed*)
|
|
46
|
+
|
|
47
|
+
**Rectangular Type (``CONDUIT.subtype == 'RECTANGULAR'``)**
|
|
48
|
+
|
|
49
|
+
Args:
|
|
50
|
+
friction_eq (str): Friction equation to use (``'MANNING'`` or ``'COLEBROOK-WHITE'``)
|
|
51
|
+
invert (float): Elevation of invert above datum (m)
|
|
52
|
+
width (float): Width of conduit (m)
|
|
53
|
+
height (float): Height of conduit (m)
|
|
54
|
+
use_bottom_slot (str): Whether to include bottom slot (``'ON'``, ``'OFF'`` or ``'GLOBAL'``). Setting it to 'GLOBAL' will use the default option specified in IEF.
|
|
55
|
+
bottom_slot_dist (float): Distance of slot top above invert (m)
|
|
56
|
+
bottom_slot_depth (float): Total depth of bottom slot (m)
|
|
57
|
+
use_top_slot (str): Whether to include top slot (``'ON'``, ``'OFF'`` or ``'GLOBAL'``). Setting it to 'GLOBAL' will use the default option specified in IEF.
|
|
58
|
+
top_slot_dist (float): Distance of slot bottom below soffit (m)
|
|
59
|
+
top_slot_depth (float): Total depth of top slot (m)
|
|
60
|
+
friction_on_invert (float): Friction value for conduit invert
|
|
61
|
+
friction_on_walls (float): Friction value for conduit walls
|
|
62
|
+
friction_on_soffit (float): Friction value for conduit soffit
|
|
63
|
+
|
|
64
|
+
**Circular Type (``CONDUIT.subtype == 'CIRCULAR'``)**
|
|
65
|
+
|
|
66
|
+
Args:
|
|
67
|
+
friction_eq (str): Friction equation to use (``'MANNING'`` or ``'COLEBROOK-WHITE'``)
|
|
68
|
+
invert (float): Elevation of invert above datum (m)
|
|
69
|
+
diameter (float): Diameter of conduit (m)
|
|
70
|
+
use_bottom_slot (str): Whether to include bottom slot (``'ON'``, ``'OFF'`` or ``'GLOBAL'``). Setting it to 'GLOBAL' will use the default option specified in IEF.
|
|
71
|
+
bottom_slot_dist (float): Distance of slot top above invert (m)
|
|
72
|
+
bottom_slot_depth (float): Total depth of bottom slot (m)
|
|
73
|
+
use_top_slot (str): Whether to include top slot (``'ON'``, ``'OFF'`` or ``'GLOBAL'``). Setting it to 'GLOBAL' will use the default option specified in IEF.
|
|
74
|
+
top_slot_dist (float): Distance of slot bottom below soffit (m)
|
|
75
|
+
top_slot_depth (float): Total depth of top slot (m)
|
|
76
|
+
friction_below_axis (float): Friction value for conduit below axis
|
|
77
|
+
friction_above_axis (float): Friction value for conduit above axis
|
|
78
|
+
|
|
79
|
+
**Sprung Type (``CONDUIT.subtype == 'SPRUNG'``)**
|
|
80
|
+
|
|
81
|
+
Args:
|
|
82
|
+
equation (str): Choose between the Manning's formulation and the Colbrook-White's formulation
|
|
83
|
+
elevation_invert (float): Height of the conduit above datum (m)
|
|
84
|
+
width (float): Width of conduit (m)
|
|
85
|
+
height_springing (float): Height of conduit's springing (m)
|
|
86
|
+
height_crown (float): Height of conduit's crown (m)
|
|
87
|
+
use_bottom_slot (str): Whether to include bottom slot (``'ON'``, ``'OFF'`` or ``'GLOBAL'``). Setting it to 'GLOBAL' will use the default option specified in IEF.
|
|
88
|
+
bottom_slot_dist (float): Distance of slot top above invert (m)
|
|
89
|
+
bottom_slot_depth (float): Total depth of bottom slot (m)
|
|
90
|
+
use_top_slot (str): Whether to include top slot (``'ON'``, ``'OFF'`` or ``'GLOBAL'``). Setting it to 'GLOBAL' will use the default option specified in IEF.
|
|
91
|
+
top_slot_dist (float): Distance of slot bottom below soffit (m)
|
|
92
|
+
top_slot_depth (float): Total depth of top slot (m)
|
|
93
|
+
friction_on_invert (float): Friction value for conduit invert
|
|
94
|
+
friction_on_walls (float): Friction value for conduit walls
|
|
95
|
+
friction_on_soffit (float): Friction value for conduit soffit
|
|
96
|
+
|
|
97
|
+
**Sprungarch Type (``CONDUIT.subtype == 'SPRUNGARCH'``)**
|
|
98
|
+
|
|
99
|
+
Args:
|
|
100
|
+
equation (str): Choose between the Manning's formulation and the Colbrook-White's formulation
|
|
101
|
+
elevation_invert (float): Height of the conduit above datum (m)
|
|
102
|
+
width (float): Width of conduit (m)
|
|
103
|
+
height_springing (float): Height of conduit's springing (m)
|
|
104
|
+
height_crown (float): Height of conduit's crown (m)
|
|
105
|
+
use_bottom_slot (str): Whether to include bottom slot (``'ON'``, ``'OFF'`` or ``'GLOBAL'``). Setting it to 'GLOBAL' will use the default option specified in IEF.
|
|
106
|
+
bottom_slot_dist (float): Distance of slot top above invert (m)
|
|
107
|
+
bottom_slot_depth (float): Total depth of bottom slot (m)
|
|
108
|
+
use_top_slot (str): Whether to include top slot (``'ON'``, ``'OFF'`` or ``'GLOBAL'``). Setting it to 'GLOBAL' will use the default option specified in IEF.
|
|
109
|
+
top_slot_dist (float): Distance of slot bottom below soffit (m)
|
|
110
|
+
top_slot_depth (float): Total depth of top slot (m)
|
|
111
|
+
friction_on_invert (float): Friction value for conduit invert
|
|
112
|
+
friction_on_walls (float): Friction value for conduit walls
|
|
113
|
+
friction_on_soffit (float): Friction value for conduit soffit
|
|
114
|
+
|
|
115
|
+
**Section Type (``CONDUIT.subtype == 'SECTION'``)**
|
|
116
|
+
|
|
117
|
+
Args:
|
|
118
|
+
None - common args attributes only
|
|
119
|
+
|
|
120
|
+
Raises:
|
|
121
|
+
NotImplementedError: Raised if class is initialised without existing Conduit block (i.e. if attempting to create new
|
|
122
|
+
Conduit unit). This will be an option for future releases
|
|
123
|
+
|
|
124
|
+
Returns:
|
|
125
|
+
CONDUIT: Flood Modeller CONDUIT Unit class object
|
|
126
|
+
"""
|
|
127
|
+
|
|
128
|
+
_unit = "CONDUIT"
|
|
129
|
+
|
|
130
|
+
def _create_from_blank( # noqa: PLR0913
|
|
131
|
+
self,
|
|
132
|
+
name="new_unit",
|
|
133
|
+
spill="",
|
|
134
|
+
comment="",
|
|
135
|
+
dist_to_next=0.0,
|
|
136
|
+
subtype="SECTION",
|
|
137
|
+
friction_eq="MANNING",
|
|
138
|
+
invert=0.0,
|
|
139
|
+
width=0.0,
|
|
140
|
+
height=0.0,
|
|
141
|
+
use_bottom_slot="GLOBAL",
|
|
142
|
+
bottom_slot_dist=0.0,
|
|
143
|
+
bottom_slot_depth=0.0,
|
|
144
|
+
use_top_slot="GLOBAL",
|
|
145
|
+
top_slot_dist=0.0,
|
|
146
|
+
top_slot_depth=0.0,
|
|
147
|
+
friction_on_invert=0.0,
|
|
148
|
+
friction_on_walls=0.0,
|
|
149
|
+
friction_on_soffit=0.0,
|
|
150
|
+
diameter=0.0,
|
|
151
|
+
friction_above_axis=0.0,
|
|
152
|
+
):
|
|
153
|
+
for param, val in {
|
|
154
|
+
"name": name,
|
|
155
|
+
"spill": spill,
|
|
156
|
+
"comment": comment,
|
|
157
|
+
"dist_to_next": dist_to_next,
|
|
158
|
+
"subtype": subtype,
|
|
159
|
+
"friction_eq": friction_eq,
|
|
160
|
+
"invert": invert,
|
|
161
|
+
"width": width,
|
|
162
|
+
"height": height,
|
|
163
|
+
"use_bottom_slot": use_bottom_slot,
|
|
164
|
+
"bottom_slot_dist": bottom_slot_dist,
|
|
165
|
+
"bottom_slot_depth": bottom_slot_depth,
|
|
166
|
+
"use_top_slot": use_top_slot,
|
|
167
|
+
"top_slot_dist": top_slot_dist,
|
|
168
|
+
"top_slot_depth": top_slot_depth,
|
|
169
|
+
"friction_on_invert": friction_on_invert,
|
|
170
|
+
"friction_on_walls": friction_on_walls,
|
|
171
|
+
"friction_on_soffit": friction_on_soffit,
|
|
172
|
+
"diameter": diameter,
|
|
173
|
+
"friction_above_axis": friction_above_axis,
|
|
174
|
+
}.items():
|
|
175
|
+
if param == "subtype":
|
|
176
|
+
self._subtype = val
|
|
177
|
+
else:
|
|
178
|
+
setattr(self, param, val)
|
|
179
|
+
|
|
180
|
+
def _read(self, c_block): # noqa: PLR0915
|
|
181
|
+
"""Function to read a given CONDUIT block and store data as class attributes"""
|
|
182
|
+
self._subtype = c_block[1].split(" ")[0].strip()
|
|
183
|
+
# Extends label line to be correct length before splitting to pick up blank labels
|
|
184
|
+
labels = split_n_char(f"{c_block[2]:<{2*self._label_len}}", self._label_len)
|
|
185
|
+
self.name = labels[0]
|
|
186
|
+
self.spill = labels[1]
|
|
187
|
+
self.comment = c_block[0].replace("CONDUIT", "").strip()
|
|
188
|
+
|
|
189
|
+
# Read CIRCULAR type unit
|
|
190
|
+
if self._subtype == "CIRCULAR":
|
|
191
|
+
# Read Params
|
|
192
|
+
self.dist_to_next = _to_float(split_10_char(c_block[3])[0])
|
|
193
|
+
self.friction_eq = c_block[4].strip()
|
|
194
|
+
params = split_10_char(f"{c_block[5]:<80}")
|
|
195
|
+
self.invert = _to_float(params[0])
|
|
196
|
+
self.diameter = _to_float(params[1])
|
|
197
|
+
self.use_bottom_slot = _to_str(params[2], "GLOBAL")
|
|
198
|
+
self.bottom_slot_dist = _to_float(params[3])
|
|
199
|
+
self.bottom_slot_depth = _to_float(params[4])
|
|
200
|
+
self.use_top_slot = _to_str(params[5], "GLOBAL")
|
|
201
|
+
self.top_slot_dist = _to_float(params[6])
|
|
202
|
+
self.top_slot_depth = _to_float(params[7])
|
|
203
|
+
friction_params = split_10_char(f"{c_block[6]:<20}")
|
|
204
|
+
self.friction_below_axis = _to_float(friction_params[0])
|
|
205
|
+
self.friction_above_axis = _to_float(friction_params[1])
|
|
206
|
+
|
|
207
|
+
elif self._subtype == "RECTANGULAR":
|
|
208
|
+
# Read Params
|
|
209
|
+
self.dist_to_next = _to_float(split_10_char(c_block[3])[0])
|
|
210
|
+
self.friction_eq = c_block[4].strip()
|
|
211
|
+
params = split_10_char(f"{c_block[5]:<90}")
|
|
212
|
+
self.invert = _to_float(params[0])
|
|
213
|
+
self.width = _to_float(params[1])
|
|
214
|
+
self.height = _to_float(params[2])
|
|
215
|
+
self.use_bottom_slot = _to_str(params[3], "GLOBAL")
|
|
216
|
+
self.bottom_slot_dist = _to_float(params[4])
|
|
217
|
+
self.bottom_slot_depth = _to_float(params[5])
|
|
218
|
+
self.use_top_slot = _to_str(params[6], "GLOBAL")
|
|
219
|
+
self.top_slot_dist = _to_float(params[7])
|
|
220
|
+
self.top_slot_depth = _to_float(params[8])
|
|
221
|
+
friction_params = split_10_char(f"{c_block[6]:<30}")
|
|
222
|
+
self.friction_on_invert = _to_float(friction_params[0])
|
|
223
|
+
self.friction_on_walls = _to_float(friction_params[1])
|
|
224
|
+
self.friction_on_soffit = _to_float(friction_params[2])
|
|
225
|
+
|
|
226
|
+
elif self._subtype in ("SPRUNG", "SPRUNGARCH"):
|
|
227
|
+
self.dist_to_next = _to_float(split_10_char(c_block[3])[0])
|
|
228
|
+
self.equation = _to_str(c_block[4], "MANNING")
|
|
229
|
+
params = split_10_char(f"{c_block[5]:<100}")
|
|
230
|
+
self.elevation_invert = _to_float(params[0])
|
|
231
|
+
self.width = _to_float(params[1])
|
|
232
|
+
self.height_springing = _to_float(params[2])
|
|
233
|
+
self.height_crown = _to_float(params[3])
|
|
234
|
+
self.use_bottom_slot = _to_str(params[4], "GLOBAL")
|
|
235
|
+
self.bottom_slot_dist = _to_float(params[5])
|
|
236
|
+
self.bottom_slot_depth = _to_float(params[6])
|
|
237
|
+
self.use_top_slot = _to_str(params[7], "GLOBAL")
|
|
238
|
+
self.top_slot_dist = _to_float(params[8])
|
|
239
|
+
self.top_slot_depth = _to_float(params[9])
|
|
240
|
+
friction_params = split_10_char(f"{c_block[6]:<30}")
|
|
241
|
+
self.friction_on_invert = _to_float(friction_params[0])
|
|
242
|
+
self.friction_on_walls = _to_float(friction_params[1])
|
|
243
|
+
self.friction_on_soffit = _to_float(friction_params[2])
|
|
244
|
+
|
|
245
|
+
elif self._subtype == "SECTION":
|
|
246
|
+
self.dist_to_next = _to_float(split_10_char(c_block[3])[0])
|
|
247
|
+
end_index = 5 + _to_int(c_block[4])
|
|
248
|
+
x = []
|
|
249
|
+
y = []
|
|
250
|
+
friction = []
|
|
251
|
+
for i in range(5, end_index):
|
|
252
|
+
row_data = split_10_char(f"{c_block[i]:<30}")
|
|
253
|
+
x.append(_to_float(row_data[0]))
|
|
254
|
+
y.append(_to_float(row_data[1]))
|
|
255
|
+
friction.append(_to_float(row_data[2]))
|
|
256
|
+
self.coords = pd.DataFrame({"x": x, "y": y, "cw_friction": friction})
|
|
257
|
+
|
|
258
|
+
else:
|
|
259
|
+
# This else block is triggered for conduit subtypes which aren't yet supported, and just keeps the '_block' in it's raw state to write back.
|
|
260
|
+
print(
|
|
261
|
+
f'This Conduit sub-type: "{self._subtype}" is currently unsupported for reading/editing',
|
|
262
|
+
)
|
|
263
|
+
self._raw_block = c_block
|
|
264
|
+
|
|
265
|
+
def _write(self):
|
|
266
|
+
"""Function to write a valid CONDUIT block"""
|
|
267
|
+
_validate_unit(self) # Function to check the params are valid for CONDUIT unit
|
|
268
|
+
header = "CONDUIT " + self.comment
|
|
269
|
+
labels = join_n_char_ljust(self._label_len, self.name, self.spill)
|
|
270
|
+
c_block = [header, self._subtype, labels]
|
|
271
|
+
|
|
272
|
+
if self._subtype == "CIRCULAR":
|
|
273
|
+
params = join_10_char(
|
|
274
|
+
self.invert,
|
|
275
|
+
self.diameter,
|
|
276
|
+
self.use_bottom_slot,
|
|
277
|
+
self.bottom_slot_dist,
|
|
278
|
+
self.bottom_slot_depth,
|
|
279
|
+
self.use_top_slot,
|
|
280
|
+
self.top_slot_dist,
|
|
281
|
+
self.top_slot_depth,
|
|
282
|
+
)
|
|
283
|
+
friction_params = f"{self.friction_below_axis:>10.4f}{self.friction_above_axis:>10.4f}"
|
|
284
|
+
c_block.extend(
|
|
285
|
+
[
|
|
286
|
+
f"{self.dist_to_next:>10.3f}",
|
|
287
|
+
self.friction_eq,
|
|
288
|
+
params,
|
|
289
|
+
friction_params,
|
|
290
|
+
],
|
|
291
|
+
)
|
|
292
|
+
return c_block
|
|
293
|
+
|
|
294
|
+
if self._subtype == "RECTANGULAR":
|
|
295
|
+
params = join_10_char(
|
|
296
|
+
self.invert,
|
|
297
|
+
self.width,
|
|
298
|
+
self.height,
|
|
299
|
+
self.use_bottom_slot,
|
|
300
|
+
self.bottom_slot_dist,
|
|
301
|
+
self.bottom_slot_depth,
|
|
302
|
+
self.use_top_slot,
|
|
303
|
+
self.top_slot_dist,
|
|
304
|
+
self.top_slot_depth,
|
|
305
|
+
)
|
|
306
|
+
friction_params = f"{self.friction_on_invert:>10.4f}{self.friction_on_walls:>10.4f}{self.friction_on_soffit:>10.4f}"
|
|
307
|
+
c_block.extend(
|
|
308
|
+
[
|
|
309
|
+
f"{self.dist_to_next:>10.3f}",
|
|
310
|
+
self.friction_eq,
|
|
311
|
+
params,
|
|
312
|
+
friction_params,
|
|
313
|
+
],
|
|
314
|
+
)
|
|
315
|
+
return c_block
|
|
316
|
+
|
|
317
|
+
if self._subtype == "SPRUNG":
|
|
318
|
+
c_block.extend(
|
|
319
|
+
[
|
|
320
|
+
str(self.dist_to_next),
|
|
321
|
+
self.equation,
|
|
322
|
+
join_10_char(
|
|
323
|
+
self.elevation_invert,
|
|
324
|
+
self.width,
|
|
325
|
+
self.height_springing,
|
|
326
|
+
self.height_crown,
|
|
327
|
+
self.use_bottom_slot,
|
|
328
|
+
self.bottom_slot_dist,
|
|
329
|
+
self.bottom_slot_depth,
|
|
330
|
+
self.use_top_slot,
|
|
331
|
+
self.top_slot_dist,
|
|
332
|
+
self.top_slot_depth,
|
|
333
|
+
),
|
|
334
|
+
join_10_char(
|
|
335
|
+
self.friction_on_invert,
|
|
336
|
+
self.friction_on_walls,
|
|
337
|
+
self.friction_on_soffit,
|
|
338
|
+
),
|
|
339
|
+
],
|
|
340
|
+
)
|
|
341
|
+
return c_block
|
|
342
|
+
|
|
343
|
+
if self._subtype == "SPRUNGARCH":
|
|
344
|
+
c_block.extend(
|
|
345
|
+
[
|
|
346
|
+
str(self.dist_to_next),
|
|
347
|
+
self.equation,
|
|
348
|
+
join_10_char(
|
|
349
|
+
self.elevation_invert,
|
|
350
|
+
self.width,
|
|
351
|
+
self.height_springing,
|
|
352
|
+
self.height_crown,
|
|
353
|
+
self.use_bottom_slot,
|
|
354
|
+
self.bottom_slot_dist,
|
|
355
|
+
self.bottom_slot_depth,
|
|
356
|
+
self.use_top_slot,
|
|
357
|
+
self.top_slot_dist,
|
|
358
|
+
self.top_slot_depth,
|
|
359
|
+
),
|
|
360
|
+
join_10_char(
|
|
361
|
+
self.friction_on_invert,
|
|
362
|
+
self.friction_on_walls,
|
|
363
|
+
self.friction_on_soffit,
|
|
364
|
+
),
|
|
365
|
+
],
|
|
366
|
+
)
|
|
367
|
+
return c_block
|
|
368
|
+
|
|
369
|
+
if self._subtype == "SECTION":
|
|
370
|
+
c_block.extend(
|
|
371
|
+
[
|
|
372
|
+
join_10_char(self.dist_to_next),
|
|
373
|
+
join_10_char(len(self.coords)),
|
|
374
|
+
],
|
|
375
|
+
)
|
|
376
|
+
for _, coord in self.coords.iterrows():
|
|
377
|
+
c_block.extend(
|
|
378
|
+
[join_10_char(coord.x, coord.y) + join_10_char(coord.cw_friction, dp=6)],
|
|
379
|
+
)
|
|
380
|
+
return c_block
|
|
381
|
+
|
|
382
|
+
return self._raw_block
|