floodmodeller-api 0.5.3.post1__py3-none-any.whl → 0.5.3.post2__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/dat.py +99 -49
- floodmodeller_api/test/test_dat.py +73 -1
- floodmodeller_api/test/test_data/All Units 4_6.DAT +0 -2
- floodmodeller_api/test/test_data/All Units 4_6.feb +0 -2
- floodmodeller_api/test/test_data/duplicate_unit_test.dat +18 -0
- floodmodeller_api/test/test_data/duplicate_unit_test_unsupported.dat +28 -0
- floodmodeller_api/test/test_data/encoding_test_cp1252.dat +0 -2
- floodmodeller_api/test/test_data/encoding_test_utf8.dat +0 -2
- floodmodeller_api/test/test_data/remove_dummy_test.dat +19 -0
- floodmodeller_api/test/test_json.py +3 -0
- floodmodeller_api/test/test_read_file.py +3 -0
- floodmodeller_api/units/units.py +1 -0
- floodmodeller_api/version.py +1 -1
- {floodmodeller_api-0.5.3.post1.dist-info → floodmodeller_api-0.5.3.post2.dist-info}/METADATA +1 -1
- {floodmodeller_api-0.5.3.post1.dist-info → floodmodeller_api-0.5.3.post2.dist-info}/RECORD +19 -16
- {floodmodeller_api-0.5.3.post1.dist-info → floodmodeller_api-0.5.3.post2.dist-info}/WHEEL +0 -0
- {floodmodeller_api-0.5.3.post1.dist-info → floodmodeller_api-0.5.3.post2.dist-info}/entry_points.txt +0 -0
- {floodmodeller_api-0.5.3.post1.dist-info → floodmodeller_api-0.5.3.post2.dist-info}/licenses/LICENSE.txt +0 -0
- {floodmodeller_api-0.5.3.post1.dist-info → floodmodeller_api-0.5.3.post2.dist-info}/top_level.txt +0 -0
floodmodeller_api/dat.py
CHANGED
|
@@ -453,12 +453,14 @@ class DAT(FMFile):
|
|
|
453
453
|
"losses": [],
|
|
454
454
|
"connectors": [],
|
|
455
455
|
"controls": [],
|
|
456
|
+
"_unsupported": [],
|
|
456
457
|
}
|
|
457
458
|
|
|
458
459
|
for block in self._dat_struct:
|
|
459
460
|
# Check for all supported boundary types
|
|
460
|
-
if block["Type"] not in units.
|
|
461
|
+
if block["Type"] not in units.ALL_UNIT_TYPES:
|
|
461
462
|
continue
|
|
463
|
+
unit_type = block["Type"]
|
|
462
464
|
# clause for when unit has been inserted into the dat file
|
|
463
465
|
if "new_insert" in block:
|
|
464
466
|
block["start"] = prev_block_end + 1
|
|
@@ -474,24 +476,26 @@ class DAT(FMFile):
|
|
|
474
476
|
]
|
|
475
477
|
prev_block_len = len(unit_data)
|
|
476
478
|
|
|
477
|
-
if
|
|
479
|
+
if unit_type == "INITIAL CONDITIONS":
|
|
478
480
|
new_unit_data = self.initial_conditions._write()
|
|
479
|
-
elif
|
|
481
|
+
elif unit_type == "COMMENT":
|
|
480
482
|
comment = comment_units[comment_tracker]
|
|
481
483
|
new_unit_data = comment._write()
|
|
482
484
|
comment_tracker += 1
|
|
483
485
|
|
|
484
|
-
elif
|
|
486
|
+
elif unit_type == "VARIABLES":
|
|
485
487
|
new_unit_data = self.variables._write()
|
|
486
488
|
|
|
487
489
|
else:
|
|
488
|
-
if units.SUPPORTED_UNIT_TYPES
|
|
489
|
-
unit_name =
|
|
490
|
+
if unit_type in units.SUPPORTED_UNIT_TYPES:
|
|
491
|
+
unit_name = self._get_supported_unit_name(unit_type, unit_data)
|
|
492
|
+
unit_group_str = units.SUPPORTED_UNIT_TYPES[unit_type]["group"]
|
|
490
493
|
else:
|
|
491
|
-
unit_name =
|
|
494
|
+
unit_name, _ = self._get_unsupported_unit_name(unit_type, unit_data)
|
|
495
|
+
unit_name = f"{unit_name} ({unit_type})"
|
|
496
|
+
unit_group_str = "_unsupported"
|
|
492
497
|
|
|
493
498
|
# Get unit object
|
|
494
|
-
unit_group_str = units.SUPPORTED_UNIT_TYPES[block["Type"]]["group"]
|
|
495
499
|
unit_group = getattr(self, unit_group_str)
|
|
496
500
|
if unit_name in unit_group:
|
|
497
501
|
# block still exists
|
|
@@ -577,14 +581,25 @@ class DAT(FMFile):
|
|
|
577
581
|
def _process_unsupported_unit(self, unit_type, unit_data) -> None:
|
|
578
582
|
# Check to see whether unit type has associated subtypes so that unit name can be correctly assigned
|
|
579
583
|
unit_name, subtype = self._get_unsupported_unit_name(unit_type, unit_data)
|
|
580
|
-
|
|
584
|
+
unit_name_and_type = f"{unit_name} ({unit_type})"
|
|
585
|
+
if unit_name_and_type in self._unsupported:
|
|
586
|
+
msg = (
|
|
587
|
+
f"Duplicate label ({unit_name_and_type}) encountered within category: _unsupported"
|
|
588
|
+
)
|
|
589
|
+
raise Exception(msg)
|
|
590
|
+
self._unsupported[unit_name_and_type] = units.UNSUPPORTED(
|
|
581
591
|
unit_data,
|
|
582
592
|
self._label_len,
|
|
583
593
|
unit_name=unit_name,
|
|
584
594
|
unit_type=unit_type,
|
|
585
595
|
subtype=subtype,
|
|
586
596
|
)
|
|
587
|
-
self._all_units.append(self._unsupported[
|
|
597
|
+
self._all_units.append(self._unsupported[unit_name_and_type])
|
|
598
|
+
|
|
599
|
+
def _get_supported_unit_name(self, unit_type: str, unit_data: list[str]) -> str:
|
|
600
|
+
if units.SUPPORTED_UNIT_TYPES[unit_type]["has_subtype"]:
|
|
601
|
+
return unit_data[2][: self._label_len].strip()
|
|
602
|
+
return unit_data[1][: self._label_len].strip()
|
|
588
603
|
|
|
589
604
|
def _get_unsupported_unit_name(self, unit_type: str, unit_data: list[str]) -> tuple[str, bool]:
|
|
590
605
|
# Check if the unit type has associated subtypes
|
|
@@ -708,6 +723,19 @@ class DAT(FMFile):
|
|
|
708
723
|
|
|
709
724
|
return unit_block, in_block
|
|
710
725
|
|
|
726
|
+
@property
|
|
727
|
+
def node_labels(self):
|
|
728
|
+
all_labels = set()
|
|
729
|
+
for unit in self._all_units:
|
|
730
|
+
all_labels.update(unit.all_labels)
|
|
731
|
+
return all_labels
|
|
732
|
+
|
|
733
|
+
def _get_unit_group_name(self, unit: Unit) -> str:
|
|
734
|
+
unit_type = unit.unit
|
|
735
|
+
if unit_type in units.SUPPORTED_UNIT_TYPES:
|
|
736
|
+
return units.SUPPORTED_UNIT_TYPES[unit_type]["group"]
|
|
737
|
+
return "_unsupported"
|
|
738
|
+
|
|
711
739
|
@handle_exception(when="remove unit from")
|
|
712
740
|
def remove_unit(self, unit: Unit) -> None:
|
|
713
741
|
"""Remove a unit from the dat file.
|
|
@@ -732,19 +760,23 @@ class DAT(FMFile):
|
|
|
732
760
|
# remove from raw data
|
|
733
761
|
del self._raw_data[dat_struct_unit["start"] : dat_struct_unit["end"] + 1]
|
|
734
762
|
# remove from unit group
|
|
735
|
-
unit_group_name =
|
|
763
|
+
unit_group_name = self._get_unit_group_name(unit)
|
|
736
764
|
unit_group = getattr(self, unit_group_name)
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
765
|
+
if unit_group_name == "_unsupported":
|
|
766
|
+
del unit_group[f"{unit.name} ({unit.unit})"]
|
|
767
|
+
else:
|
|
768
|
+
del unit_group[unit.name]
|
|
769
|
+
# remove from ICs if no more labels
|
|
770
|
+
if unit.name not in self.node_labels:
|
|
771
|
+
self.initial_conditions.data = self.initial_conditions.data.loc[
|
|
772
|
+
self.initial_conditions.data["label"] != unit.name
|
|
773
|
+
]
|
|
774
|
+
self.general_parameters["Node Count"] -= 1
|
|
742
775
|
|
|
743
776
|
self._update_dat_struct()
|
|
744
|
-
self.general_parameters["Node Count"] -= 1
|
|
745
777
|
|
|
746
778
|
@handle_exception(when="insert unit into")
|
|
747
|
-
def insert_unit(
|
|
779
|
+
def insert_unit(
|
|
748
780
|
self,
|
|
749
781
|
unit: Unit,
|
|
750
782
|
add_before: Unit | None = None,
|
|
@@ -767,6 +799,48 @@ class DAT(FMFile):
|
|
|
767
799
|
NameError: Raised if unit name already appears in unit group.
|
|
768
800
|
"""
|
|
769
801
|
# catch errors
|
|
802
|
+
self._validate_insert_unit_params(unit, add_before, add_after, add_at)
|
|
803
|
+
|
|
804
|
+
unit_class = unit._unit
|
|
805
|
+
if unit_class != "COMMENT":
|
|
806
|
+
_validate_unit(unit)
|
|
807
|
+
unit_group_name = self._get_unit_group_name(unit)
|
|
808
|
+
unit_group = getattr(self, unit_group_name)
|
|
809
|
+
if unit.name in unit_group:
|
|
810
|
+
msg = "Name already appears in unit group. Cannot have two units with same name in same group"
|
|
811
|
+
raise NameError(msg)
|
|
812
|
+
|
|
813
|
+
insert_index = self._get_insert_index(add_before, add_after, add_at)
|
|
814
|
+
|
|
815
|
+
unit_data = unit._write()
|
|
816
|
+
if unit._unit != "COMMENT":
|
|
817
|
+
if unit_group_name == "_unsupported":
|
|
818
|
+
unit_group[f"{unit.name} ({unit.unit})"] = unit
|
|
819
|
+
else:
|
|
820
|
+
unit_group[unit.name] = unit
|
|
821
|
+
self._dat_struct.insert(
|
|
822
|
+
insert_index + 1,
|
|
823
|
+
{"Type": unit_class, "new_insert": unit_data},
|
|
824
|
+
) # add to dat struct without unit.name
|
|
825
|
+
|
|
826
|
+
if unit._unit != "COMMENT" and unit.name not in self.node_labels:
|
|
827
|
+
# update the iic's tables
|
|
828
|
+
iic_data = [unit.name, "y", 00.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
|
|
829
|
+
self.initial_conditions.data.loc[len(self.initial_conditions.data)] = iic_data # flaged
|
|
830
|
+
self.general_parameters["Node Count"] += 1 # flag no update for comments
|
|
831
|
+
|
|
832
|
+
self._all_units.insert(insert_index, unit)
|
|
833
|
+
if not defer_update:
|
|
834
|
+
self._update_raw_data()
|
|
835
|
+
self._update_dat_struct()
|
|
836
|
+
|
|
837
|
+
def _validate_insert_unit_params(
|
|
838
|
+
self,
|
|
839
|
+
unit: Unit,
|
|
840
|
+
add_before: Unit | None,
|
|
841
|
+
add_after: Unit | None,
|
|
842
|
+
add_at: int | None,
|
|
843
|
+
):
|
|
770
844
|
provided_params = sum(arg is not None for arg in (add_before, add_after, add_at))
|
|
771
845
|
if provided_params == 0:
|
|
772
846
|
msg = "No positional argument given. Please provide either add_before, add_at or add_after"
|
|
@@ -781,15 +855,12 @@ class DAT(FMFile):
|
|
|
781
855
|
msg = "add_before or add_after argument must be a Flood Modeller Unit type"
|
|
782
856
|
raise TypeError(msg)
|
|
783
857
|
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
msg = "Name already appears in unit group. Cannot have two units with same name in same group"
|
|
791
|
-
raise NameError(msg)
|
|
792
|
-
|
|
858
|
+
def _get_insert_index(
|
|
859
|
+
self,
|
|
860
|
+
add_before: Unit | None,
|
|
861
|
+
add_after: Unit | None,
|
|
862
|
+
add_at: int | None,
|
|
863
|
+
) -> int:
|
|
793
864
|
# positional argument
|
|
794
865
|
if add_at is not None:
|
|
795
866
|
insert_index = add_at
|
|
@@ -810,28 +881,7 @@ class DAT(FMFile):
|
|
|
810
881
|
f"{check_unit} not found in dat network, so cannot be used to add before/after"
|
|
811
882
|
)
|
|
812
883
|
raise Exception(msg)
|
|
813
|
-
|
|
814
|
-
unit_data = unit._write()
|
|
815
|
-
self._all_units.insert(insert_index, unit)
|
|
816
|
-
if unit._unit != "COMMENT":
|
|
817
|
-
unit_group[unit.name] = unit
|
|
818
|
-
self._dat_struct.insert(
|
|
819
|
-
insert_index + 1,
|
|
820
|
-
{"Type": unit_class, "new_insert": unit_data},
|
|
821
|
-
) # add to dat struct without unit.name
|
|
822
|
-
|
|
823
|
-
if unit._unit != "COMMENT":
|
|
824
|
-
# update the iic's tables
|
|
825
|
-
iic_data = [unit.name, "y", 00.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
|
|
826
|
-
self.initial_conditions.data.loc[len(self.initial_conditions.data)] = iic_data # flaged
|
|
827
|
-
|
|
828
|
-
# update all
|
|
829
|
-
if unit._unit != "COMMENT":
|
|
830
|
-
self.general_parameters["Node Count"] += 1 # flag no update for comments
|
|
831
|
-
|
|
832
|
-
if not defer_update:
|
|
833
|
-
self._update_raw_data()
|
|
834
|
-
self._update_dat_struct()
|
|
884
|
+
return insert_index
|
|
835
885
|
|
|
836
886
|
def insert_units(
|
|
837
887
|
self,
|
|
@@ -5,7 +5,7 @@ from unittest.mock import patch
|
|
|
5
5
|
import pytest
|
|
6
6
|
|
|
7
7
|
from floodmodeller_api import DAT
|
|
8
|
-
from floodmodeller_api.units import JUNCTION, LATERAL, QTBDY, RESERVOIR
|
|
8
|
+
from floodmodeller_api.units import JUNCTION, LATERAL, QTBDY, RESERVOIR, UNSUPPORTED
|
|
9
9
|
from floodmodeller_api.util import FloodModellerAPIError
|
|
10
10
|
|
|
11
11
|
|
|
@@ -42,6 +42,28 @@ def dat_ex6(test_workspace):
|
|
|
42
42
|
yield dat
|
|
43
43
|
|
|
44
44
|
|
|
45
|
+
@pytest.fixture()
|
|
46
|
+
def unsupported_dummy_unit():
|
|
47
|
+
data = [
|
|
48
|
+
"APITESTDUMMY Dummy unnsupported unit for testing purposes",
|
|
49
|
+
"LBL001 LBL002",
|
|
50
|
+
"arbitrary data",
|
|
51
|
+
" table01234",
|
|
52
|
+
" -0.500 0.000 0.000 0.000091000000.0",
|
|
53
|
+
" 0.000 1.000 1.000 0.0000 910000000",
|
|
54
|
+
" 1.000 2.000 2.000 0.000091000000.0",
|
|
55
|
+
" 2.000 3.000 3.000 0.000091000000.0",
|
|
56
|
+
" 5.000 3.000 3.000 0.000091000000.0",
|
|
57
|
+
]
|
|
58
|
+
return UNSUPPORTED(
|
|
59
|
+
data,
|
|
60
|
+
12,
|
|
61
|
+
unit_name="LBL001",
|
|
62
|
+
unit_type="APITESTDUMMY",
|
|
63
|
+
subtype=False,
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
|
|
45
67
|
def test_changing_section_and_dist_works(dat_fp, data_before):
|
|
46
68
|
"""DAT: Test changing and reverting section name and dist to next makes no changes"""
|
|
47
69
|
dat = DAT(dat_fp)
|
|
@@ -74,6 +96,9 @@ def test_changing_and_reverting_qtbdy_hydrograph_works(dat_fp, data_before):
|
|
|
74
96
|
def test_dat_read_doesnt_change_data(test_workspace, tmp_path):
|
|
75
97
|
"""DAT: Check all '.dat' files in folder by reading the _write() output into a new DAT instance and checking it stays the same."""
|
|
76
98
|
for datfile in Path(test_workspace).glob("*.dat"):
|
|
99
|
+
if datfile.name.startswith("duplicate_unit_test"):
|
|
100
|
+
# Skipping as invalid DAT (duplicate units)
|
|
101
|
+
continue
|
|
77
102
|
dat = DAT(datfile)
|
|
78
103
|
first_output = dat._write()
|
|
79
104
|
new_path = tmp_path / "tmp.dat"
|
|
@@ -380,3 +405,50 @@ def test_encoding(test_workspace: Path, dat_str: str, label: str, tmp_path: Path
|
|
|
380
405
|
|
|
381
406
|
assert label in dat_read.sections
|
|
382
407
|
assert label in dat_write.sections # remains as \xc3\xa5 even for utf8
|
|
408
|
+
|
|
409
|
+
|
|
410
|
+
def test_insert_unsupported_unit(tmp_path: Path, unsupported_dummy_unit):
|
|
411
|
+
new_dat = DAT()
|
|
412
|
+
new_dat.insert_unit(unsupported_dummy_unit, add_at=-1)
|
|
413
|
+
assert unsupported_dummy_unit in new_dat._unsupported.values()
|
|
414
|
+
assert len(new_dat._all_units) == 1
|
|
415
|
+
filepath = tmp_path / "insert_dummy_test.dat"
|
|
416
|
+
new_dat.save(filepath)
|
|
417
|
+
|
|
418
|
+
dat = DAT(filepath)
|
|
419
|
+
assert unsupported_dummy_unit in dat._unsupported.values()
|
|
420
|
+
assert len(dat._all_units) == 1
|
|
421
|
+
|
|
422
|
+
|
|
423
|
+
def test_remove_unsupported_unit(test_workspace, unsupported_dummy_unit):
|
|
424
|
+
dat = DAT(test_workspace / "remove_dummy_test.dat")
|
|
425
|
+
assert len(dat._all_units) == 1
|
|
426
|
+
assert len(dat._dat_struct) == 3
|
|
427
|
+
assert len(dat.initial_conditions.data) == 1
|
|
428
|
+
assert "LBL001 (APITESTDUMMY)" in dat._unsupported
|
|
429
|
+
dat.remove_unit(unsupported_dummy_unit)
|
|
430
|
+
assert len(dat._all_units) == 0
|
|
431
|
+
assert len(dat._dat_struct) == 2
|
|
432
|
+
assert len(dat.initial_conditions.data) == 0
|
|
433
|
+
assert "LBL001 (APITESTDUMMY)" not in dat._unsupported
|
|
434
|
+
dat._write()
|
|
435
|
+
assert len(dat._all_units) == 0
|
|
436
|
+
assert len(dat._dat_struct) == 2
|
|
437
|
+
assert len(dat.initial_conditions.data) == 0
|
|
438
|
+
assert "LBL001 (APITESTDUMMY)" not in dat._unsupported
|
|
439
|
+
|
|
440
|
+
|
|
441
|
+
def test_duplicate_unit_raises_error(test_workspace):
|
|
442
|
+
msg = (
|
|
443
|
+
r"\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
|
|
444
|
+
r"\nAPI Error: Problem encountered when trying to read DAT file .*\."
|
|
445
|
+
r"\n"
|
|
446
|
+
r"\nDetails: .*-floodmodeller_api/dat\.py-\d+"
|
|
447
|
+
r"\nMsg: Duplicate label (.*) encountered within category: .*"
|
|
448
|
+
r"\n"
|
|
449
|
+
r"\nFor additional support, go to: https://github\.com/People-Places-Solutions/floodmodeller-api"
|
|
450
|
+
)
|
|
451
|
+
with pytest.raises(FloodModellerAPIError, match=msg):
|
|
452
|
+
DAT(test_workspace / "duplicate_unit_test.dat")
|
|
453
|
+
with pytest.raises(FloodModellerAPIError, match=msg):
|
|
454
|
+
DAT(test_workspace / "duplicate_unit_test_unsupported.dat")
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
duplicate units for test
|
|
2
|
+
#REVISION#1
|
|
3
|
+
1 0.750 0.900 0.100 0.001 12
|
|
4
|
+
10.000 0.010 0.010 0.700 0.100 0.700 0.000
|
|
5
|
+
RAD FILE
|
|
6
|
+
|
|
7
|
+
END GENERAL
|
|
8
|
+
QTBDY
|
|
9
|
+
qtboundary
|
|
10
|
+
1 0.000 0.000 seconds EXTEND LINEAR 1.000
|
|
11
|
+
20.000 0.000
|
|
12
|
+
QTBDY
|
|
13
|
+
qtboundary
|
|
14
|
+
1 0.000 0.000 seconds EXTEND LINEAR 1.000
|
|
15
|
+
20.000 0.000
|
|
16
|
+
GISINFO
|
|
17
|
+
QTBDY 0 478 986 0 0 1
|
|
18
|
+
0 0 0 0 0 0
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
duplicate units for test
|
|
2
|
+
#REVISION#1
|
|
3
|
+
2 0.750 0.900 0.100 0.001 12
|
|
4
|
+
10.000 0.010 0.010 0.700 0.100 0.700 0.000
|
|
5
|
+
RAD FILE
|
|
6
|
+
|
|
7
|
+
END GENERAL
|
|
8
|
+
APITESTDUMMY Dummy unnsupported unit for testing purposes
|
|
9
|
+
LBL001 LBL002
|
|
10
|
+
arbitrary data
|
|
11
|
+
table01234
|
|
12
|
+
-0.500 0.000 0.000 0.000091000000.0
|
|
13
|
+
0.000 1.000 1.000 0.0000 910000000
|
|
14
|
+
1.000 2.000 2.000 0.000091000000.0
|
|
15
|
+
2.000 3.000 3.000 0.000091000000.0
|
|
16
|
+
5.000 3.000 3.000 0.000091000000.0
|
|
17
|
+
APITESTDUMMY Dummy unnsupported unit for testing purposes
|
|
18
|
+
LBL001 LBL002
|
|
19
|
+
arbitrary data
|
|
20
|
+
table01234
|
|
21
|
+
-0.500 0.000 0.000 0.000091000000.0
|
|
22
|
+
0.000 1.000 1.000 0.0000 910000000
|
|
23
|
+
1.000 2.000 2.000 0.000091000000.0
|
|
24
|
+
2.000 3.000 3.000 0.000091000000.0
|
|
25
|
+
5.000 3.000 3.000 0.000091000000.0
|
|
26
|
+
GISINFO
|
|
27
|
+
APITESTDUMMY 0 478 986 0 0 1
|
|
28
|
+
0 0 0 0 0 0
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
|
|
2
|
+
#REVISION#1
|
|
3
|
+
1 0.750 0.900 0.100 0.001 12SI
|
|
4
|
+
10.000 0.010 0.010 0.700 0.100 0.700 0.000
|
|
5
|
+
RAD FILE
|
|
6
|
+
|
|
7
|
+
END GENERAL
|
|
8
|
+
APITESTDUMMY Dummy unnsupported unit for testing purposes
|
|
9
|
+
LBL001 LBL002
|
|
10
|
+
arbitrary data
|
|
11
|
+
table01234
|
|
12
|
+
-0.500 0.000 0.000 0.000091000000.0
|
|
13
|
+
0.000 1.000 1.000 0.0000 910000000
|
|
14
|
+
1.000 2.000 2.000 0.000091000000.0
|
|
15
|
+
2.000 3.000 3.000 0.000091000000.0
|
|
16
|
+
5.000 3.000 3.000 0.000091000000.0
|
|
17
|
+
INITIAL CONDITIONS
|
|
18
|
+
label ? flow stage froude no velocity umode ustate z
|
|
19
|
+
LBL001 y 0.000 0.000 0.000 0.000 0.000 0.000 0.000
|
|
@@ -105,6 +105,9 @@ def test_obj_reproduces_from_json_for_all_test_api_files(
|
|
|
105
105
|
):
|
|
106
106
|
"""JSON: To test the from_json function, It should produce the same dat file from a json file"""
|
|
107
107
|
for file in Path(test_workspace).glob(file_extension_glob):
|
|
108
|
+
if file.name.startswith("duplicate_unit_test"):
|
|
109
|
+
# Skipping as invalid DAT (duplicate units)
|
|
110
|
+
continue
|
|
108
111
|
assert api_class(file) == api_class.from_json(api_class(file).to_json())
|
|
109
112
|
|
|
110
113
|
|
|
@@ -6,6 +6,9 @@ from floodmodeller_api.util import FloodModellerAPIError
|
|
|
6
6
|
|
|
7
7
|
def test_read_file(test_workspace):
|
|
8
8
|
for file in test_workspace.glob("*"):
|
|
9
|
+
if file.name.startswith("duplicate_unit_test"):
|
|
10
|
+
# Skipping as invalid DAT (duplicate units)
|
|
11
|
+
continue
|
|
9
12
|
if (
|
|
10
13
|
file.suffix.lower()
|
|
11
14
|
in [
|
floodmodeller_api/units/units.py
CHANGED
|
@@ -89,6 +89,7 @@ UNSUPPORTED_UNIT_TYPES: dict[str, UnsupportedUnitTypes] = {
|
|
|
89
89
|
"SCWEIR": {"group": "structures", "has_subtype": False}, # sharp crested weir
|
|
90
90
|
"SYPHON": {"group": "structures", "has_subtype": False}, # syphon unit
|
|
91
91
|
"TIDBDY": {"group": "boundaries", "has_subtype": False}, # tidal
|
|
92
|
+
"APITESTDUMMY": {"group": None, "has_subtype": False}, # Made up for API testing
|
|
92
93
|
}
|
|
93
94
|
|
|
94
95
|
ALL_UNIT_TYPES = set(SUPPORTED_UNIT_TYPES.keys()).union(UNSUPPORTED_UNIT_TYPES)
|
floodmodeller_api/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.5.3.
|
|
1
|
+
__version__ = "0.5.3.post2"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
floodmodeller_api/__init__.py,sha256=gPtU8nKJL-XHb19XuMryUpwlYNA3dlHlxl8xy69KPQA,400
|
|
2
2
|
floodmodeller_api/_base.py,sha256=XY5bxyGzppQnY1SSL9qqBK0wCmvC9t3lQnj-jfnRLBU,7971
|
|
3
3
|
floodmodeller_api/backup.py,sha256=Pdqq3VF-aiEuLOGFyoEINLc_vauhUeaNedJTa1cWDLI,11139
|
|
4
|
-
floodmodeller_api/dat.py,sha256=
|
|
4
|
+
floodmodeller_api/dat.py,sha256=6RFMs3QX-6zNX7uKdzcw6I6qrTHOFhFysg3itNQG0UE,41949
|
|
5
5
|
floodmodeller_api/diff.py,sha256=y7W5l-03iYdm-YPcwrbHZMdlXFhBe0JEl-WahWL_pi8,5208
|
|
6
6
|
floodmodeller_api/ied.py,sha256=q8FWV2cQso7Tt9m73XGnK_5ZHTfQGW_LLtxwsY2sTus,12313
|
|
7
7
|
floodmodeller_api/ief.py,sha256=u_VYIGkBQwHY7nSXVhT0G6-UkWmlpPLzkzodi9OPrIg,31891
|
|
@@ -11,7 +11,7 @@ floodmodeller_api/mapping.py,sha256=eHbGYd7lFptmRvPYi4PxkvbD72w953RUb6KXKeiHTwg,
|
|
|
11
11
|
floodmodeller_api/to_from_json.py,sha256=qyRKRe4mpdNBo6XgXVrP9dI3oqYY8Px5YcGm690F-jg,7427
|
|
12
12
|
floodmodeller_api/tool.py,sha256=Lpx4LiF_OhCqt8KiXNtOrYx1K0tSwxig2ZJcGU3gbM4,11330
|
|
13
13
|
floodmodeller_api/util.py,sha256=16oY6ia5SJjyjKYIoxa8jMw_sZ828y73NWbpe31ig-w,4590
|
|
14
|
-
floodmodeller_api/version.py,sha256=
|
|
14
|
+
floodmodeller_api/version.py,sha256=zKeBz8S6Z0KUv148ZHc0BBoYP3-sYyz8NYODGVCk8SQ,28
|
|
15
15
|
floodmodeller_api/xml2d.py,sha256=MvH0oftUAdQRrsvxifXQOFwk0eB3sQOUX3qwU-58W6s,25698
|
|
16
16
|
floodmodeller_api/xml2d_template.py,sha256=lu0tM7-YysYniqAw331bhvulH0Ha5xKsgtIo9KTnyNw,1806
|
|
17
17
|
floodmodeller_api/xsd_backup.xml,sha256=hRZYhpNcucT7TgFPhuINMAEJOkds-lg6n7RH3b2jeq4,28430
|
|
@@ -36,7 +36,7 @@ floodmodeller_api/test/__init__.py,sha256=H_reXbKdnzqlFWBdfJIPsgtRIXY7BxM1_p4oOv
|
|
|
36
36
|
floodmodeller_api/test/conftest.py,sha256=_qZ3fepZ6TM-IbieVDIzHt5R8u-BybUbhGAZgdFKdzA,301
|
|
37
37
|
floodmodeller_api/test/test_backup.py,sha256=_hGjDladK-EXa9uqzMlW7pJMvCldxiYdJn7dtqVQJq4,4221
|
|
38
38
|
floodmodeller_api/test/test_conveyance.py,sha256=Urw85ev6aDMfKKwL4qG0pKSutnlPP9ZlXyag538kqQI,4075
|
|
39
|
-
floodmodeller_api/test/test_dat.py,sha256=
|
|
39
|
+
floodmodeller_api/test/test_dat.py,sha256=fSJNqyo-CrQBItKQnQZT9Rmm084V49hQr-B7W3H5lIM,17395
|
|
40
40
|
floodmodeller_api/test/test_flowtimeprofile.py,sha256=yB70e_1SEjfbk1mmqtGRWHt8KYs_FgFjHfdUiAGWR0g,4114
|
|
41
41
|
floodmodeller_api/test/test_fmfile.py,sha256=RTe1Rpy1sRK-_QzStrTJe7GNlC0ruURMdkoHZ2kozrY,550
|
|
42
42
|
floodmodeller_api/test/test_hydrology_plus_export.py,sha256=USY-mqqNkmagkd_gfKGGj0ZTASQHQ30LKRBFBKTKKaw,7350
|
|
@@ -44,9 +44,9 @@ floodmodeller_api/test/test_ied.py,sha256=VRscnsFPdYEVHNeJpUZW-ftUKvSBl4y_NjjsLX
|
|
|
44
44
|
floodmodeller_api/test/test_ief.py,sha256=uhcljtMgyW2wAx9T7Ccq37hvQAYVZlTiSVz7kea2cXs,8377
|
|
45
45
|
floodmodeller_api/test/test_inp.py,sha256=2KYo3cgvngZrXblL8Xtqpl2bJS9nCOog3rDtqHem3gg,1493
|
|
46
46
|
floodmodeller_api/test/test_integrated_bridge.py,sha256=m81pA5AQpfVPvG8OX9NlsXD_8Z8MIoa8SIGrdmTMV28,5157
|
|
47
|
-
floodmodeller_api/test/test_json.py,sha256=
|
|
47
|
+
floodmodeller_api/test/test_json.py,sha256=ndsBPAYh6zIfDluSyOa0YqKzH_qlVFF3N8GViV-RSPc,4380
|
|
48
48
|
floodmodeller_api/test/test_logs_lf.py,sha256=gODj_Ysm_hf-upScPKpCDkuoTZFUgr5-FdB5hM7Y2iw,5290
|
|
49
|
-
floodmodeller_api/test/test_read_file.py,sha256=
|
|
49
|
+
floodmodeller_api/test/test_read_file.py,sha256=3gOz7sl1zQUwg6MCBDTFOcZDtldpQbWa0mi51zcFKPQ,911
|
|
50
50
|
floodmodeller_api/test/test_river.py,sha256=hZXATFm2chYr0OlJQgEsa30o__X-hhGSvKYpV7iWlQU,8620
|
|
51
51
|
floodmodeller_api/test/test_sluice.py,sha256=-t_3k2QZahJCTG3U60buUfFpUfA0ANngRABhMb8oM1w,1241
|
|
52
52
|
floodmodeller_api/test/test_tool.py,sha256=izvi9YF4hVqP57uVFkmBMD2wJvd93LeIo7XF-JZ2RZM,4245
|
|
@@ -55,8 +55,8 @@ floodmodeller_api/test/test_unit.py,sha256=PNyJDwhlVfT0nMWLrhi8HeeM7dstRPRlzse9f
|
|
|
55
55
|
floodmodeller_api/test/test_xml2d.py,sha256=pMwNySpxuCkidFimdD-0kQSYGc3jJFdak98nUZGwmqo,5149
|
|
56
56
|
floodmodeller_api/test/test_zz.py,sha256=DVmossrrOI5fnXi8V8KWvzCmgOaZeobxcxT7G7OY53s,4414
|
|
57
57
|
floodmodeller_api/test/test_data/7082.ief,sha256=IfH9Oybu3Mwemt1WLjLF_B3_7gud4O673R4QajvUIuU,748
|
|
58
|
-
floodmodeller_api/test/test_data/All Units 4_6.DAT,sha256=
|
|
59
|
-
floodmodeller_api/test/test_data/All Units 4_6.feb,sha256=
|
|
58
|
+
floodmodeller_api/test/test_data/All Units 4_6.DAT,sha256=udlIuVTtCJXFAFKZwS3AgPjr0EuVVOa9L3sEjWU6604,32569
|
|
59
|
+
floodmodeller_api/test/test_data/All Units 4_6.feb,sha256=udlIuVTtCJXFAFKZwS3AgPjr0EuVVOa9L3sEjWU6604,32569
|
|
60
60
|
floodmodeller_api/test/test_data/BRIDGE.DAT,sha256=tJZgLmKyzErVpj0rYIQfWBUJHBsGETkMY01CJvEfGJA,31756
|
|
61
61
|
floodmodeller_api/test/test_data/BaseModel_2D_Q100.ief,sha256=BrotqABIiDabs-DmNwlrjD-u-Twud5Sz2wyArzoVq0Q,660
|
|
62
62
|
floodmodeller_api/test/test_data/Baseline_unchecked.csv,sha256=uakQjcVVCbafCOAhPuoT-Zgkf-9HyvJ4GHubB-ZzFjs,9049
|
|
@@ -120,8 +120,10 @@ floodmodeller_api/test/test_data/defaultUnits.feb,sha256=GM6Ne-6Ce3tf6BhHJm0XpPA
|
|
|
120
120
|
floodmodeller_api/test/test_data/defaultUnits.fmpx,sha256=DF9E6x38IlhwMS2ENva62kwM-kerj9FqVZAT5ozNOB0,2392
|
|
121
121
|
floodmodeller_api/test/test_data/defaultUnits.gxy,sha256=H4cuPLiGSXxr4OtgK2-q3oRfssa4BPU730hiJd7K1c8,972
|
|
122
122
|
floodmodeller_api/test/test_data/df_flows_hplus.csv,sha256=1mXiFFjw7aqdd-QsmSH8bKgwCR2hBGxkiyuHyEd97X4,7703
|
|
123
|
-
floodmodeller_api/test/test_data/
|
|
124
|
-
floodmodeller_api/test/test_data/
|
|
123
|
+
floodmodeller_api/test/test_data/duplicate_unit_test.dat,sha256=62fT73-6hiW9biH-hLQF8Q3d7Eed427O-iilVGs2oRQ,450
|
|
124
|
+
floodmodeller_api/test/test_data/duplicate_unit_test_unsupported.dat,sha256=EWEleUjncQJdBkvFklAoliFfICG3hTwdPrZdKmJJ0F4,971
|
|
125
|
+
floodmodeller_api/test/test_data/encoding_test_cp1252.dat,sha256=fwcE38umUj4cR4vCxfnhxhyxzZurfhtK9ZTWPUfvQGI,32569
|
|
126
|
+
floodmodeller_api/test/test_data/encoding_test_utf8.dat,sha256=XPcvlF6hUwGxL0V1bvME5dFZCpxda4jyNCtXPMlnme4,32570
|
|
125
127
|
floodmodeller_api/test/test_data/event_hplus.csv,sha256=C2pDyjnQs0pte2Zh6jft00Y5j6qNWzkSKrHd6Yx7iXY,523
|
|
126
128
|
floodmodeller_api/test/test_data/ex3.ief,sha256=fnNuyiIRry7-onvcTkA_IOJF2VHnCzxzB-IMb5vqXtM,361
|
|
127
129
|
floodmodeller_api/test/test_data/ex3.lf1,sha256=nM6Sh9mw1oo-FVZbqurZu_YSCODlhMGW4mEgXgoSFTg,91578
|
|
@@ -170,6 +172,7 @@ floodmodeller_api/test/test_data/network.zzx,sha256=aT1RW2nerZuCOtcvxJ8VJqL-Ly8I
|
|
|
170
172
|
floodmodeller_api/test/test_data/network_dat_expected.json,sha256=usRioM5sXeMSgwTfNCKYN4jO3E4uQu69zwBtSmqUXvM,623625
|
|
171
173
|
floodmodeller_api/test/test_data/network_ied_expected.json,sha256=6ng9RLh4D2--8oxVZBdlJBec2z1W3ZL3FDTvZFMZ8HA,8409
|
|
172
174
|
floodmodeller_api/test/test_data/network_with_comments.ied,sha256=bIbV_wJ_BDb5Zx2V_w82VtVtmNJYptH9RVF2VTZ7dPE,1003
|
|
175
|
+
floodmodeller_api/test/test_data/remove_dummy_test.dat,sha256=6hZYi7pD_IStMJjhB4XXhwgH0gB8Z__NKIGDjMIjZV8,739
|
|
173
176
|
floodmodeller_api/test/test_data/rnweir.dat,sha256=GM6Ne-6Ce3tf6BhHJm0XpPA6aRtNTCqhckfkO-UI0Sw,269
|
|
174
177
|
floodmodeller_api/test/test_data/rnweir.ext,sha256=QW8XUTJuO9SWT6DCkgUvePXIJb2B9vsD4ppo46yywtk,468
|
|
175
178
|
floodmodeller_api/test/test_data/rnweir.feb,sha256=GM6Ne-6Ce3tf6BhHJm0XpPA6aRtNTCqhckfkO-UI0Sw,269
|
|
@@ -233,7 +236,7 @@ floodmodeller_api/units/iic.py,sha256=3fl_90HETaIdVSlJexBKiLtJ473sT4UEusS1k5Dd-W
|
|
|
233
236
|
floodmodeller_api/units/losses.py,sha256=pl5eNKUmnWjmyH03B0A5YhzgLTn1APuXYgr1VIrSut8,11972
|
|
234
237
|
floodmodeller_api/units/sections.py,sha256=ntunzD9ePp3z2Qw5XKlwJ468EP7eOPC8ZoGEhpRawIM,19795
|
|
235
238
|
floodmodeller_api/units/structures.py,sha256=3KsZs3XX3ztJv_HddONIiEDNdZ0Fp3Pw8kE8RFOuIAg,67375
|
|
236
|
-
floodmodeller_api/units/units.py,sha256=
|
|
239
|
+
floodmodeller_api/units/units.py,sha256=pKofHXAVClcOsoypPx_sAOwXa6B-Geoz3WT0_fWvL5M,5395
|
|
237
240
|
floodmodeller_api/units/unsupported.py,sha256=TtNJjLiJt1dqYmIYxj799TM5HXjN_imR51CkzkK7B9I,1770
|
|
238
241
|
floodmodeller_api/units/variables.py,sha256=g1VCxgJbd5Tv9Njn4B_UBTo1Sa8eBP3j8Efko8p0lgI,3061
|
|
239
242
|
floodmodeller_api/urban1d/__init__.py,sha256=7-_TpJTV8N2SoTEOpHUo0pi87ue8BqBii5FldTc_SjA,192
|
|
@@ -250,9 +253,9 @@ floodmodeller_api/validation/__init__.py,sha256=sUMqShUGLnuQjmxKN3wAR7XpDVYsSFn4
|
|
|
250
253
|
floodmodeller_api/validation/parameters.py,sha256=VG6wlDiA5A5cm3TEhYCJ4dNqzm8Hl1X7CMpohBIdOjQ,16585
|
|
251
254
|
floodmodeller_api/validation/urban_parameters.py,sha256=tD4ORsexmvvVZhDxbRyDlYyEH4uswySxiTIs2JWZwKs,11391
|
|
252
255
|
floodmodeller_api/validation/validation.py,sha256=rwNNmUP2VSfv196Iv6HbGI-PeC_YxTCQM_4stcEB5lk,4665
|
|
253
|
-
floodmodeller_api-0.5.3.
|
|
254
|
-
floodmodeller_api-0.5.3.
|
|
255
|
-
floodmodeller_api-0.5.3.
|
|
256
|
-
floodmodeller_api-0.5.3.
|
|
257
|
-
floodmodeller_api-0.5.3.
|
|
258
|
-
floodmodeller_api-0.5.3.
|
|
256
|
+
floodmodeller_api-0.5.3.post2.dist-info/licenses/LICENSE.txt,sha256=las1guEzggQukja_R_nI5E6jGEYEnpQdJoTZvup2e5E,920
|
|
257
|
+
floodmodeller_api-0.5.3.post2.dist-info/METADATA,sha256=fvv-0Y4rDuNinDEr6VVjaNY5n8smA1u6nHKGo3esVvs,5794
|
|
258
|
+
floodmodeller_api-0.5.3.post2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
259
|
+
floodmodeller_api-0.5.3.post2.dist-info/entry_points.txt,sha256=RQFzb_zf1hNv2uNRfoCD3nRzyzGi8vPvj7VGOhrOjtI,198
|
|
260
|
+
floodmodeller_api-0.5.3.post2.dist-info/top_level.txt,sha256=x10nxct120kv2PpqYA2lhiwrYre3wKyic2wcUyNWWRw,18
|
|
261
|
+
floodmodeller_api-0.5.3.post2.dist-info/RECORD,,
|
|
File without changes
|
{floodmodeller_api-0.5.3.post1.dist-info → floodmodeller_api-0.5.3.post2.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
|
File without changes
|
{floodmodeller_api-0.5.3.post1.dist-info → floodmodeller_api-0.5.3.post2.dist-info}/top_level.txt
RENAMED
|
File without changes
|