floodmodeller-api 0.5.0__py3-none-any.whl → 0.5.0.post1__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.
@@ -167,3 +167,80 @@ def test_create_from_blank_with_params():
167
167
  " 1.000 2.000 0.010 0.000 0.000 0.000 ",
168
168
  " 2.000 5.000 0.010 0.000 0.000 0.000 ",
169
169
  ]
170
+
171
+
172
+ def test_set_river_dataframe_correct():
173
+ unit = RIVER(
174
+ [
175
+ "RIVER normal case",
176
+ "SECTION",
177
+ "SomeUnit",
178
+ " 0.000 0.000100 1000.000",
179
+ " 5",
180
+ " 0.000 10 0.030",
181
+ " 1.000 9 0.030",
182
+ " 2.000 5 0.030",
183
+ " 3.000 6 0.030",
184
+ " 4.000 10 0.030",
185
+ ],
186
+ )
187
+
188
+ df = pd.DataFrame(
189
+ {
190
+ "X": [0.0, 1.0, 2.0],
191
+ "Y": [5.0, 2.0, 5.0],
192
+ "Mannings n": [0.01, 0.01, 0.01],
193
+ "Panel": ["", "", ""],
194
+ "RPL": [0.0, 0.0, 0.0],
195
+ "Marker": ["", "", ""],
196
+ "Easting": [0.0, 0.0, 0.0],
197
+ "Northing": [0.0, 0.0, 0.0],
198
+ "Deactivation": ["", "", ""],
199
+ "SP. Marker": ["", "", ""],
200
+ },
201
+ )
202
+
203
+ unit.data = df.copy()
204
+ pd.testing.assert_frame_equal(unit._data, df.copy())
205
+
206
+
207
+ def test_set_river_dataframe_incorrect():
208
+ unit = RIVER()
209
+
210
+ df = pd.DataFrame(
211
+ {
212
+ "X": [0.0, 1.0, 2.0],
213
+ "Y": [5.0, 2.0, 5.0],
214
+ "Mannings n": [0.01, 0.01, 0.01],
215
+ "RPL": [0.0, 0.0, 0.0],
216
+ "Marker": ["", "", ""],
217
+ "Easting": [0.0, 0.0, 0.0],
218
+ "Deactivation": ["", "", ""],
219
+ "SP. Marker": ["", "", ""],
220
+ },
221
+ )
222
+
223
+ with pytest.raises(ValueError):
224
+ unit.data = df.copy()
225
+
226
+
227
+ def test_set_river_dataframe_case_sensitivity():
228
+ unit = RIVER()
229
+
230
+ df = pd.DataFrame(
231
+ {
232
+ "x": [0.0, 1.0, 2.0],
233
+ "Y": [5.0, 2.0, 5.0],
234
+ "mANNINGs n": [0.01, 0.01, 0.01],
235
+ "Panel": ["", "", ""],
236
+ "RPL": [0.0, 0.0, 0.0],
237
+ "Marker": ["", "", ""],
238
+ "Easting": [0.0, 0.0, 0.0],
239
+ "Northing": [0.0, 0.0, 0.0],
240
+ "Deactivation": ["", "", ""],
241
+ "SP. Marker": ["", "", ""],
242
+ },
243
+ )
244
+
245
+ unit.data = df.copy()
246
+ pd.testing.assert_frame_equal(unit._data, df.copy())
@@ -72,11 +72,12 @@ def calculate_cross_section_conveyance(
72
72
  total_length = np.where(in_panel_and_section, length, 0).sum(axis=1)
73
73
  total_mannings = np.where(in_panel_and_section, mannings, 0).sum(axis=1)
74
74
 
75
- conveyance += np.where(
76
- total_length >= MINIMUM_PERIMETER_THRESHOLD,
77
- total_area ** (5 / 3) * total_length ** (1 / 3) / (total_mannings * rpl_panel),
78
- 0,
79
- )
75
+ with np.errstate(invalid="ignore"):
76
+ conveyance += np.where(
77
+ total_length >= MINIMUM_PERIMETER_THRESHOLD,
78
+ total_area ** (5 / 3) * total_length ** (1 / 3) / (total_mannings * rpl_panel),
79
+ 0,
80
+ )
80
81
 
81
82
  return pd.Series(conveyance, index=water_levels)
82
83
 
@@ -116,9 +117,10 @@ def calculate_geometry(
116
117
  is_submerged_on_right = (h1 <= 0) & (h2 > 0)
117
118
  conditions = [is_submerged, is_submerged_on_left, is_submerged_on_right]
118
119
 
119
- # needed for partially submerged sections
120
- dx_left = dx * h1 / (h1 - h2)
121
- dx_right = dx * h2 / (h2 - h1)
120
+ with np.errstate(divide="ignore", invalid="ignore"):
121
+ # needed for partially submerged sections
122
+ dx_left = dx * h1 / (h1 - h2)
123
+ dx_right = dx * h2 / (h2 - h1)
122
124
 
123
125
  area = np.select(
124
126
  conditions,
@@ -260,7 +260,7 @@ class RIVER(Unit):
260
260
  raise ValueError(
261
261
  "The updated data table for a cross section must be a pandas DataFrame.",
262
262
  )
263
- if new_df.columns != self._required_columns:
263
+ if list(map(str.lower, new_df.columns)) != list(map(str.lower, self._required_columns)):
264
264
  raise ValueError(f"The DataFrame must only contain columns: {self._required_columns}")
265
265
  self._data = new_df
266
266
 
@@ -1 +1 @@
1
- __version__ = "0.5.0"
1
+ __version__ = "0.5.0.post1"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: floodmodeller_api
3
- Version: 0.5.0
3
+ Version: 0.5.0.post1
4
4
  Summary: Extends the functionality of Flood Modeller to python users
5
5
  Author: Jacobs
6
6
  Author-email: joe.pierce@jacobs.com
@@ -11,7 +11,7 @@ floodmodeller_api/mapping.py,sha256=hCZbQ-_v6dEHxkFkG0cjkeI7FCHSi5UqDk49yBjzZO0,
11
11
  floodmodeller_api/to_from_json.py,sha256=3UNBEOmh717cyDoylmFCngwokXu9b2Jm3FKk1Oum9wk,7287
12
12
  floodmodeller_api/tool.py,sha256=brN4A2NR08W1xDnyoniHJo1MYchAVNs9Nif5mwebRPs,11284
13
13
  floodmodeller_api/util.py,sha256=vfU2GDK2ozrsQonwP3jeeEvjACqKlTWECTa-r5VIgoI,3994
14
- floodmodeller_api/version.py,sha256=LBK46heutvn3KmsCrKIYu8RQikbfnjZaj2xFrXaeCzQ,22
14
+ floodmodeller_api/version.py,sha256=J1kBZAgpuK-WFUqCCzGZrBt454s_I5sVWXeEXZ7DyLQ,28
15
15
  floodmodeller_api/xml2d.py,sha256=lJ7oL9u7YMXc9Eimpv8c44d-MN5IWtu7VsGRNW26pSY,25710
16
16
  floodmodeller_api/xml2d_template.py,sha256=iaPdZHN6pEHf-QDSDwfUeDhd9QyuQPY_NUz7cvZLs7g,1806
17
17
  floodmodeller_api/xsd_backup.xml,sha256=hRZYhpNcucT7TgFPhuINMAEJOkds-lg6n7RH3b2jeq4,28430
@@ -45,7 +45,7 @@ floodmodeller_api/test/test_inp.py,sha256=k6Unz41_CjcUEzRtg_KiQ4G2o3tA5iEK8Zx64N
45
45
  floodmodeller_api/test/test_json.py,sha256=LrCGDgz_3Ajv7J0LtJOB24M-cXPlQtTGlpg6oE4-ieo,4084
46
46
  floodmodeller_api/test/test_logs_lf.py,sha256=bLsvSTy3e_NcE0338DdfyDEFn6CfQXfbmPQElMpfakw,2890
47
47
  floodmodeller_api/test/test_read_file.py,sha256=vA_qRtq1ffkp5zOrzAXBwIjPYNHtEV_HVRP3hgilPRc,754
48
- floodmodeller_api/test/test_river.py,sha256=AUi0FaLJ2WyFx4wT6c1_TC39qNWHWoCcswVulrbXJs0,6459
48
+ floodmodeller_api/test/test_river.py,sha256=g7O1n6GTmexV1o3g_5zOUw601Gf6CX2_RVSvdshgluo,8534
49
49
  floodmodeller_api/test/test_tool.py,sha256=Or7nQ6XZIglpYbvKyIlvG9aERiTXtSRomeByTsP1VQ4,4058
50
50
  floodmodeller_api/test/test_toolbox_structure_log.py,sha256=GQP5L3rvdtCMEeG5QTFYmcXzdS-ISs3agmbGj0SeVdU,7255
51
51
  floodmodeller_api/test/test_xml2d.py,sha256=_Z7FI86EkfsGZkEC5Vr8RwBOdAZ3kDJF15VOhOANKrs,5091
@@ -188,11 +188,11 @@ floodmodeller_api/units/_base.py,sha256=Zxug0OgdZ5Hu3Qoj_ukR75GLotFGNtHnfbil2kCv
188
188
  floodmodeller_api/units/boundaries.py,sha256=Mf7KQKVKCNMur23OW5JutMC-whm4LQuxNmBOVgUSFbk,19873
189
189
  floodmodeller_api/units/comment.py,sha256=2RmAm0Ef8pUVBng2xoGD0R3gzaq1x7xku2bRtkhDUqA,1864
190
190
  floodmodeller_api/units/conduits.py,sha256=Pmbw7R2_FP048YzmRhrKM1Cw_UY5rNPme8PliAkdlQA,17039
191
- floodmodeller_api/units/conveyance.py,sha256=A1nckSXkJHryQmCAyegqUAcVe83OwsqSqbTn1Spu0zU,6170
191
+ floodmodeller_api/units/conveyance.py,sha256=m0L-cwwHfopr-Y3No_3wpEh0IIOlMn-MZXrM7T4fJ78,6307
192
192
  floodmodeller_api/units/helpers.py,sha256=yUAdhu1Fg3PmL_DhODzgkktwwzYYzQ6yItb0INmMJus,4068
193
193
  floodmodeller_api/units/iic.py,sha256=PHkqWLK51Trzjr5FHt84sYT-WVaPbgt_hHBSqHlbIFQ,3875
194
194
  floodmodeller_api/units/losses.py,sha256=el97L6ZATgaL7C2VTqtpmUHcR1GztkOTJpVMoXiSTko,12137
195
- floodmodeller_api/units/sections.py,sha256=Tl4T1qCZ-KwgotHJ9XkgicV8KsEzx7ZPh6qX-QuGz7c,19750
195
+ floodmodeller_api/units/sections.py,sha256=AVoa8ZmnWL5BpVTGu18KCQSY0LYrvMHeCH4G5H-vAcw,19794
196
196
  floodmodeller_api/units/structures.py,sha256=x8bIlkZmxpWBkfv1vvH-2_i8gVcqs26NyM5P03m9CRg,70960
197
197
  floodmodeller_api/units/units.py,sha256=yBN0spwgjW4vDiRr8lapwpOVKgTIvWH_LEp6zXA38fI,5053
198
198
  floodmodeller_api/units/unsupported.py,sha256=WYynzkwQcYO_9_BPRKg9RVH2NnxDX-0wy4zOr7cJtso,1917
@@ -211,9 +211,9 @@ floodmodeller_api/validation/__init__.py,sha256=sUMqShUGLnuQjmxKN3wAR7XpDVYsSFn4
211
211
  floodmodeller_api/validation/parameters.py,sha256=qnDGZLzW2Bfd7hf-IF_s-smfZfKdQieweyJo_RxDhfQ,16101
212
212
  floodmodeller_api/validation/urban_parameters.py,sha256=ChK8pSFsX6Ndl5-xw8mlNJJ2oJ-6cqc9OYE2gGP2WZk,11757
213
213
  floodmodeller_api/validation/validation.py,sha256=GH7KsrbHmTnCg_vfazKnCakbvkwua0cw6hAGStKWemg,4447
214
- floodmodeller_api-0.5.0.dist-info/LICENSE.txt,sha256=tH7I97hBX5QUpGGDbkiWdqJuWgMsBZDA8zEd_029-cM,920
215
- floodmodeller_api-0.5.0.dist-info/METADATA,sha256=jS74pT_e9H2r4hzbJsb4tpyAYWY8ngPgsTwUPBMBy9k,4980
216
- floodmodeller_api-0.5.0.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
217
- floodmodeller_api-0.5.0.dist-info/entry_points.txt,sha256=RQFzb_zf1hNv2uNRfoCD3nRzyzGi8vPvj7VGOhrOjtI,198
218
- floodmodeller_api-0.5.0.dist-info/top_level.txt,sha256=x10nxct120kv2PpqYA2lhiwrYre3wKyic2wcUyNWWRw,18
219
- floodmodeller_api-0.5.0.dist-info/RECORD,,
214
+ floodmodeller_api-0.5.0.post1.dist-info/LICENSE.txt,sha256=tH7I97hBX5QUpGGDbkiWdqJuWgMsBZDA8zEd_029-cM,920
215
+ floodmodeller_api-0.5.0.post1.dist-info/METADATA,sha256=f68Gsskfm_z2j2w2oLcxBYmdOwsMN4xDkomzDaP_XwA,4986
216
+ floodmodeller_api-0.5.0.post1.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
217
+ floodmodeller_api-0.5.0.post1.dist-info/entry_points.txt,sha256=RQFzb_zf1hNv2uNRfoCD3nRzyzGi8vPvj7VGOhrOjtI,198
218
+ floodmodeller_api-0.5.0.post1.dist-info/top_level.txt,sha256=x10nxct120kv2PpqYA2lhiwrYre3wKyic2wcUyNWWRw,18
219
+ floodmodeller_api-0.5.0.post1.dist-info/RECORD,,