floodmodeller-api 0.4.2.post1__py3-none-any.whl → 0.4.4__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.
Files changed (178) hide show
  1. floodmodeller_api/__init__.py +8 -9
  2. floodmodeller_api/_base.py +169 -176
  3. floodmodeller_api/backup.py +273 -273
  4. floodmodeller_api/dat.py +889 -831
  5. floodmodeller_api/diff.py +136 -119
  6. floodmodeller_api/ied.py +302 -306
  7. floodmodeller_api/ief.py +553 -637
  8. floodmodeller_api/ief_flags.py +253 -253
  9. floodmodeller_api/inp.py +260 -266
  10. floodmodeller_api/libs/libifcoremd.dll +0 -0
  11. floodmodeller_api/libs/libifcoremt.so.5 +0 -0
  12. floodmodeller_api/libs/libifport.so.5 +0 -0
  13. floodmodeller_api/{libmmd.dll → libs/libimf.so} +0 -0
  14. floodmodeller_api/libs/libintlc.so.5 +0 -0
  15. floodmodeller_api/libs/libmmd.dll +0 -0
  16. floodmodeller_api/libs/libsvml.so +0 -0
  17. floodmodeller_api/libs/libzzn_read.so +0 -0
  18. floodmodeller_api/libs/zzn_read.dll +0 -0
  19. floodmodeller_api/logs/__init__.py +2 -2
  20. floodmodeller_api/logs/lf.py +364 -312
  21. floodmodeller_api/logs/lf_helpers.py +354 -352
  22. floodmodeller_api/logs/lf_params.py +643 -529
  23. floodmodeller_api/mapping.py +84 -0
  24. floodmodeller_api/test/__init__.py +4 -4
  25. floodmodeller_api/test/conftest.py +16 -8
  26. floodmodeller_api/test/test_backup.py +117 -117
  27. floodmodeller_api/test/test_conveyance.py +107 -0
  28. floodmodeller_api/test/test_dat.py +222 -92
  29. floodmodeller_api/test/test_data/All Units 4_6.DAT +1081 -1081
  30. floodmodeller_api/test/test_data/All Units 4_6.feb +1081 -1081
  31. floodmodeller_api/test/test_data/BRIDGE.DAT +926 -926
  32. floodmodeller_api/test/test_data/Culvert_Inlet_Outlet.dat +36 -36
  33. floodmodeller_api/test/test_data/Culvert_Inlet_Outlet.feb +36 -36
  34. floodmodeller_api/test/test_data/DamBreakADI.xml +52 -52
  35. floodmodeller_api/test/test_data/DamBreakFAST.xml +58 -58
  36. floodmodeller_api/test/test_data/DamBreakFAST_dy.xml +53 -53
  37. floodmodeller_api/test/test_data/DamBreakTVD.xml +55 -55
  38. floodmodeller_api/test/test_data/DefenceBreach.xml +53 -53
  39. floodmodeller_api/test/test_data/DefenceBreachFAST.xml +60 -60
  40. floodmodeller_api/test/test_data/DefenceBreachFAST_dy.xml +55 -55
  41. floodmodeller_api/test/test_data/Domain1+2_QH.xml +76 -76
  42. floodmodeller_api/test/test_data/Domain1_H.xml +41 -41
  43. floodmodeller_api/test/test_data/Domain1_Q.xml +41 -41
  44. floodmodeller_api/test/test_data/Domain1_Q_FAST.xml +48 -48
  45. floodmodeller_api/test/test_data/Domain1_Q_FAST_dy.xml +48 -48
  46. floodmodeller_api/test/test_data/Domain1_Q_xml_expected.json +263 -0
  47. floodmodeller_api/test/test_data/Domain1_W.xml +41 -41
  48. floodmodeller_api/test/test_data/EX1.DAT +321 -321
  49. floodmodeller_api/test/test_data/EX1.ext +107 -107
  50. floodmodeller_api/test/test_data/EX1.feb +320 -320
  51. floodmodeller_api/test/test_data/EX1.gxy +107 -107
  52. floodmodeller_api/test/test_data/EX17.DAT +421 -422
  53. floodmodeller_api/test/test_data/EX17.ext +213 -213
  54. floodmodeller_api/test/test_data/EX17.feb +422 -422
  55. floodmodeller_api/test/test_data/EX18.DAT +375 -375
  56. floodmodeller_api/test/test_data/EX18_DAT_expected.json +3876 -0
  57. floodmodeller_api/test/test_data/EX2.DAT +302 -302
  58. floodmodeller_api/test/test_data/EX3.DAT +926 -926
  59. floodmodeller_api/test/test_data/EX3_DAT_expected.json +16235 -0
  60. floodmodeller_api/test/test_data/EX3_IEF_expected.json +61 -0
  61. floodmodeller_api/test/test_data/EX6.DAT +2084 -2084
  62. floodmodeller_api/test/test_data/EX6.ext +532 -532
  63. floodmodeller_api/test/test_data/EX6.feb +2084 -2084
  64. floodmodeller_api/test/test_data/EX6_DAT_expected.json +31647 -0
  65. floodmodeller_api/test/test_data/Event Data Example.DAT +336 -336
  66. floodmodeller_api/test/test_data/Event Data Example.ext +107 -107
  67. floodmodeller_api/test/test_data/Event Data Example.feb +336 -336
  68. floodmodeller_api/test/test_data/Linked1D2D.xml +52 -52
  69. floodmodeller_api/test/test_data/Linked1D2DFAST.xml +53 -53
  70. floodmodeller_api/test/test_data/Linked1D2DFAST_dy.xml +48 -48
  71. floodmodeller_api/test/test_data/Linked1D2D_xml_expected.json +313 -0
  72. floodmodeller_api/test/test_data/blockage.dat +50 -50
  73. floodmodeller_api/test/test_data/blockage.ext +45 -45
  74. floodmodeller_api/test/test_data/blockage.feb +9 -9
  75. floodmodeller_api/test/test_data/blockage.gxy +71 -71
  76. floodmodeller_api/test/test_data/conveyance_test.dat +165 -0
  77. floodmodeller_api/test/test_data/conveyance_test.feb +116 -0
  78. floodmodeller_api/test/test_data/conveyance_test.gxy +85 -0
  79. floodmodeller_api/test/test_data/defaultUnits.dat +127 -127
  80. floodmodeller_api/test/test_data/defaultUnits.ext +45 -45
  81. floodmodeller_api/test/test_data/defaultUnits.feb +9 -9
  82. floodmodeller_api/test/test_data/defaultUnits.fmpx +58 -58
  83. floodmodeller_api/test/test_data/defaultUnits.gxy +85 -85
  84. floodmodeller_api/test/test_data/ex3.ief +20 -20
  85. floodmodeller_api/test/test_data/ex3.lf1 +2800 -2800
  86. floodmodeller_api/test/test_data/ex4.DAT +1374 -1374
  87. floodmodeller_api/test/test_data/ex4_changed.DAT +1374 -1374
  88. floodmodeller_api/test/test_data/example1.inp +329 -329
  89. floodmodeller_api/test/test_data/example2.inp +158 -158
  90. floodmodeller_api/test/test_data/example3.inp +297 -297
  91. floodmodeller_api/test/test_data/example4.inp +388 -388
  92. floodmodeller_api/test/test_data/example5.inp +147 -147
  93. floodmodeller_api/test/test_data/example6.inp +154 -154
  94. floodmodeller_api/test/test_data/expected_conveyance.csv +60 -0
  95. floodmodeller_api/test/test_data/jump.dat +176 -176
  96. floodmodeller_api/test/test_data/network.dat +1374 -1374
  97. floodmodeller_api/test/test_data/network.ext +45 -45
  98. floodmodeller_api/test/test_data/network.exy +1 -1
  99. floodmodeller_api/test/test_data/network.feb +45 -45
  100. floodmodeller_api/test/test_data/network.ied +45 -45
  101. floodmodeller_api/test/test_data/network.ief +20 -20
  102. floodmodeller_api/test/test_data/network.inp +147 -147
  103. floodmodeller_api/test/test_data/network.pxy +57 -57
  104. floodmodeller_api/test/test_data/network.zzd +122 -122
  105. floodmodeller_api/test/test_data/network_dat_expected.json +21837 -0
  106. floodmodeller_api/test/test_data/network_from_tabularCSV.csv +87 -87
  107. floodmodeller_api/test/test_data/network_ied_expected.json +287 -0
  108. floodmodeller_api/test/test_data/rnweir.dat +9 -9
  109. floodmodeller_api/test/test_data/rnweir.ext +45 -45
  110. floodmodeller_api/test/test_data/rnweir.feb +9 -9
  111. floodmodeller_api/test/test_data/rnweir.gxy +45 -45
  112. floodmodeller_api/test/test_data/rnweir_default.dat +74 -74
  113. floodmodeller_api/test/test_data/rnweir_default.ext +45 -45
  114. floodmodeller_api/test/test_data/rnweir_default.feb +9 -9
  115. floodmodeller_api/test/test_data/rnweir_default.fmpx +58 -58
  116. floodmodeller_api/test/test_data/rnweir_default.gxy +53 -53
  117. floodmodeller_api/test/test_data/unit checks.dat +16 -16
  118. floodmodeller_api/test/test_ied.py +29 -29
  119. floodmodeller_api/test/test_ief.py +136 -24
  120. floodmodeller_api/test/test_inp.py +47 -48
  121. floodmodeller_api/test/test_json.py +114 -0
  122. floodmodeller_api/test/test_logs_lf.py +102 -51
  123. floodmodeller_api/test/test_tool.py +165 -152
  124. floodmodeller_api/test/test_toolbox_structure_log.py +234 -239
  125. floodmodeller_api/test/test_xml2d.py +151 -156
  126. floodmodeller_api/test/test_zzn.py +36 -34
  127. floodmodeller_api/to_from_json.py +230 -0
  128. floodmodeller_api/tool.py +332 -329
  129. floodmodeller_api/toolbox/__init__.py +5 -5
  130. floodmodeller_api/toolbox/example_tool.py +45 -45
  131. floodmodeller_api/toolbox/model_build/__init__.py +2 -2
  132. floodmodeller_api/toolbox/model_build/add_siltation_definition.py +100 -98
  133. floodmodeller_api/toolbox/model_build/structure_log/__init__.py +1 -1
  134. floodmodeller_api/toolbox/model_build/structure_log/structure_log.py +287 -289
  135. floodmodeller_api/toolbox/model_build/structure_log_definition.py +76 -76
  136. floodmodeller_api/units/__init__.py +10 -10
  137. floodmodeller_api/units/_base.py +214 -212
  138. floodmodeller_api/units/boundaries.py +467 -467
  139. floodmodeller_api/units/comment.py +52 -55
  140. floodmodeller_api/units/conduits.py +382 -402
  141. floodmodeller_api/units/conveyance.py +301 -0
  142. floodmodeller_api/units/helpers.py +123 -131
  143. floodmodeller_api/units/iic.py +107 -101
  144. floodmodeller_api/units/losses.py +305 -306
  145. floodmodeller_api/units/sections.py +465 -446
  146. floodmodeller_api/units/structures.py +1690 -1683
  147. floodmodeller_api/units/units.py +93 -104
  148. floodmodeller_api/units/unsupported.py +44 -44
  149. floodmodeller_api/units/variables.py +87 -89
  150. floodmodeller_api/urban1d/__init__.py +11 -11
  151. floodmodeller_api/urban1d/_base.py +188 -179
  152. floodmodeller_api/urban1d/conduits.py +93 -85
  153. floodmodeller_api/urban1d/general_parameters.py +58 -58
  154. floodmodeller_api/urban1d/junctions.py +81 -79
  155. floodmodeller_api/urban1d/losses.py +81 -74
  156. floodmodeller_api/urban1d/outfalls.py +114 -110
  157. floodmodeller_api/urban1d/raingauges.py +111 -111
  158. floodmodeller_api/urban1d/subsections.py +92 -98
  159. floodmodeller_api/urban1d/xsections.py +147 -144
  160. floodmodeller_api/util.py +119 -21
  161. floodmodeller_api/validation/parameters.py +660 -660
  162. floodmodeller_api/validation/urban_parameters.py +388 -404
  163. floodmodeller_api/validation/validation.py +110 -108
  164. floodmodeller_api/version.py +1 -1
  165. floodmodeller_api/xml2d.py +632 -673
  166. floodmodeller_api/xml2d_template.py +37 -37
  167. floodmodeller_api/zzn.py +414 -363
  168. {floodmodeller_api-0.4.2.post1.dist-info → floodmodeller_api-0.4.4.dist-info}/LICENSE.txt +13 -13
  169. {floodmodeller_api-0.4.2.post1.dist-info → floodmodeller_api-0.4.4.dist-info}/METADATA +85 -82
  170. floodmodeller_api-0.4.4.dist-info/RECORD +185 -0
  171. {floodmodeller_api-0.4.2.post1.dist-info → floodmodeller_api-0.4.4.dist-info}/WHEEL +1 -1
  172. floodmodeller_api/libifcoremd.dll +0 -0
  173. floodmodeller_api/test/test_data/EX3.bmp +0 -0
  174. floodmodeller_api/test/test_data/test_output.csv +0 -87
  175. floodmodeller_api/zzn_read.dll +0 -0
  176. floodmodeller_api-0.4.2.post1.dist-info/RECORD +0 -164
  177. {floodmodeller_api-0.4.2.post1.dist-info → floodmodeller_api-0.4.4.dist-info}/entry_points.txt +0 -0
  178. {floodmodeller_api-0.4.2.post1.dist-info → floodmodeller_api-0.4.4.dist-info}/top_level.txt +0 -0
@@ -1,5 +1,5 @@
1
- from .model_build import AddSiltation, StructureLog
2
-
3
- # from .visualisation import ...
4
- # from .model_review import ...
5
- # from .results_analysis import ...
1
+ from .model_build import AddSiltation, StructureLog
2
+
3
+ # from .visualisation import ...
4
+ # from .model_review import ...
5
+ # from .results_analysis import ...
@@ -1,45 +1,45 @@
1
- # Import the FMTool and Parameter classes to define the tool and parameters
2
- from floodmodeller_api.tool import FMTool, Parameter
3
-
4
-
5
- # ------ Define function ----- #
6
- # This is the funciton that should be run by the tool.
7
- # In this case it is just a simple sum function but you can
8
- # substitute any function in here.
9
- def my_sum(a: float, b: float):
10
- ab = a + b
11
- print(ab)
12
- return ab
13
-
14
-
15
- # ------ Create the Tool ------ #
16
- class SumTool(FMTool):
17
- # Define the name (required):
18
- name = "Sum tool"
19
- # Add the tool description (required)
20
- description = "A basic tool to add two numbers together"
21
- # Add the parameters (one per function argument):
22
- parameters = [
23
- # Add parameters using the Parameter class
24
- Parameter(
25
- name="a",
26
- dtype=float,
27
- description="the first number",
28
- help_text="",
29
- required=True,
30
- ),
31
- Parameter(
32
- name="b",
33
- dtype=float,
34
- description="the second number",
35
- help_text="",
36
- required=True,
37
- ),
38
- ]
39
- # Add the function to run
40
- tool_function = my_sum
41
-
42
-
43
- if __name__ == "__main__":
44
- tool = SumTool()
45
- tool.run_from_command_line()
1
+ # Import the FMTool and Parameter classes to define the tool and parameters
2
+ from floodmodeller_api.tool import FMTool, Parameter
3
+
4
+
5
+ # ------ Define function ----- #
6
+ # This is the funciton that should be run by the tool.
7
+ # In this case it is just a simple sum function but you can
8
+ # substitute any function in here.
9
+ def my_sum(a: float, b: float):
10
+ ab = a + b
11
+ print(ab)
12
+ return ab
13
+
14
+
15
+ # ------ Create the Tool ------ #
16
+ class SumTool(FMTool):
17
+ # Define the name (required):
18
+ name = "Sum tool"
19
+ # Add the tool description (required)
20
+ description = "A basic tool to add two numbers together"
21
+ # Add the parameters (one per function argument):
22
+ parameters = [
23
+ # Add parameters using the Parameter class
24
+ Parameter(
25
+ name="a",
26
+ dtype=float,
27
+ description="the first number",
28
+ help_text="",
29
+ required=True,
30
+ ),
31
+ Parameter(
32
+ name="b",
33
+ dtype=float,
34
+ description="the second number",
35
+ help_text="",
36
+ required=True,
37
+ ),
38
+ ]
39
+ # Add the function to run
40
+ tool_function = my_sum
41
+
42
+
43
+ if __name__ == "__main__":
44
+ tool = SumTool()
45
+ tool.run_from_command_line()
@@ -1,2 +1,2 @@
1
- from .add_siltation_definition import AddSiltation
2
- from .structure_log_definition import StructureLog
1
+ from .add_siltation_definition import AddSiltation
2
+ from .structure_log_definition import StructureLog
@@ -1,98 +1,100 @@
1
- """ This function allows you to raise the minimum bed level 300mm across all sections in a DAT file (i.e siltation) """
2
- # Import modules
3
- from pathlib import Path
4
-
5
- from floodmodeller_api import DAT
6
- from floodmodeller_api.tool import FMTool, Parameter
7
- from floodmodeller_api.units import RIVER
8
-
9
-
10
- # Define the function
11
- def raise_section_bed_levels(dat_input: Path, dat_output: Path, siltation: float):
12
- dat = DAT(dat_input) # Initialise DAT class
13
-
14
- for _, section in dat.sections.items(): # iterate through all river sections
15
- if not isinstance(section, RIVER):
16
- # Skip any non river type units (e.g. interpolates)
17
- continue
18
- df = section.data # get section data
19
- min_elevation = df["Y"].min() # get minimum cross section elevation
20
- raised_bed = min_elevation + siltation # define new lowest bed level
21
- df.loc[
22
- df["Y"] < raised_bed, "Y"
23
- ] = raised_bed # Raise any levels lower than this to the new lowest level
24
-
25
- dat.save(dat_output) # save updates
26
-
27
-
28
- # Wrap the FMTool class
29
- class AddSiltation(FMTool):
30
- """
31
- This tool allows you to add a set amount of siltation to raise the minimum bed levels of all
32
- river sections in a DAT file
33
-
34
- Args:
35
- dat_input (str): Path to the input DAT file
36
- siltation (float): Amount of siltation to raise beds (in meters)
37
- dat_output (str): Path to the output DAT file
38
-
39
-
40
- **Usage**
41
-
42
- To use this tool, you can either run it from the command line:
43
-
44
- .. code::
45
-
46
- fmapi-add_siltation --dat_input "<dat file path>" --siltation 0.3 --dat_output "<dat file output path>"
47
-
48
- Or as a gui:
49
-
50
- .. code::
51
-
52
- fmapi-add_siltation gui
53
-
54
- Or you can use it from your code:
55
-
56
- .. code:: python
57
-
58
- from floodmodeller_api.toolbox import AddSiltation
59
-
60
- AddSiltation.run(
61
- dat_input="path/to/dat.dat",
62
- siltation=0.3,
63
- dat_output="path/to/output_dat.dat",
64
- )
65
- """
66
-
67
- name = "Add Siltation"
68
- description = (
69
- "Tool to add a set amount of siltation to raise bed levels of river sections in a DAT file"
70
- )
71
- parameters = [
72
- Parameter(
73
- name="dat_input",
74
- dtype=str,
75
- description="Path to input DAT file",
76
- help_text="Path to input DAT file",
77
- required=True,
78
- ),
79
- Parameter(
80
- name="dat_output",
81
- dtype=str,
82
- description="Path to output DAT file",
83
- help_text="Path to output DAT file",
84
- required=True,
85
- ),
86
- Parameter(
87
- name="siltation",
88
- dtype=float,
89
- description="Amount of siltation to raise beds (in meters)",
90
- help_text="Amount of siltation to raise beds (in meters)",
91
- required=True,
92
- ),
93
- ]
94
- tool_function = raise_section_bed_levels
95
-
96
-
97
- def main():
98
- AddSiltation().run_from_command_line()
1
+ """ This function allows you to raise the minimum bed level 300mm across all sections in a DAT file (i.e siltation) """
2
+
3
+ # Import modules
4
+ from pathlib import Path
5
+
6
+ from floodmodeller_api import DAT
7
+ from floodmodeller_api.tool import FMTool, Parameter
8
+ from floodmodeller_api.units import RIVER
9
+
10
+
11
+ # Define the function
12
+ def raise_section_bed_levels(dat_input: Path, dat_output: Path, siltation: float):
13
+ dat = DAT(dat_input) # Initialise DAT class
14
+
15
+ for _, section in dat.sections.items(): # iterate through all river sections
16
+ if not isinstance(section, RIVER):
17
+ # Skip any non river type units (e.g. interpolates)
18
+ continue
19
+ df = section.data # get section data
20
+ min_elevation = df["Y"].min() # get minimum cross section elevation
21
+ raised_bed = min_elevation + siltation # define new lowest bed level
22
+ df.loc[
23
+ df["Y"] < raised_bed,
24
+ "Y",
25
+ ] = raised_bed # Raise any levels lower than this to the new lowest level
26
+
27
+ dat.save(dat_output) # save updates
28
+
29
+
30
+ # Wrap the FMTool class
31
+ class AddSiltation(FMTool):
32
+ """
33
+ This tool allows you to add a set amount of siltation to raise the minimum bed levels of all
34
+ river sections in a DAT file
35
+
36
+ Args:
37
+ dat_input (str): Path to the input DAT file
38
+ siltation (float): Amount of siltation to raise beds (in meters)
39
+ dat_output (str): Path to the output DAT file
40
+
41
+
42
+ **Usage**
43
+
44
+ To use this tool, you can either run it from the command line:
45
+
46
+ .. code::
47
+
48
+ fmapi-add_siltation --dat_input "<dat file path>" --siltation 0.3 --dat_output "<dat file output path>"
49
+
50
+ Or as a gui:
51
+
52
+ .. code::
53
+
54
+ fmapi-add_siltation gui
55
+
56
+ Or you can use it from your code:
57
+
58
+ .. code:: python
59
+
60
+ from floodmodeller_api.toolbox import AddSiltation
61
+
62
+ AddSiltation.run(
63
+ dat_input="path/to/dat.dat",
64
+ siltation=0.3,
65
+ dat_output="path/to/output_dat.dat",
66
+ )
67
+ """
68
+
69
+ name = "Add Siltation"
70
+ description = (
71
+ "Tool to add a set amount of siltation to raise bed levels of river sections in a DAT file"
72
+ )
73
+ parameters = [
74
+ Parameter(
75
+ name="dat_input",
76
+ dtype=str,
77
+ description="Path to input DAT file",
78
+ help_text="Path to input DAT file",
79
+ required=True,
80
+ ),
81
+ Parameter(
82
+ name="dat_output",
83
+ dtype=str,
84
+ description="Path to output DAT file",
85
+ help_text="Path to output DAT file",
86
+ required=True,
87
+ ),
88
+ Parameter(
89
+ name="siltation",
90
+ dtype=float,
91
+ description="Amount of siltation to raise beds (in meters)",
92
+ help_text="Amount of siltation to raise beds (in meters)",
93
+ required=True,
94
+ ),
95
+ ]
96
+ tool_function = raise_section_bed_levels
97
+
98
+
99
+ def main():
100
+ AddSiltation().run_from_command_line()
@@ -1 +1 @@
1
- from .structure_log import StructureLogBuilder
1
+ from .structure_log import StructureLogBuilder