Skip to content

Commit 59a697d

Browse files
authored
Merge branch 'master' into margriet_schema_300_leftovers
2 parents bf5005e + 41717dd commit 59a697d

File tree

9 files changed

+67
-34
lines changed

9 files changed

+67
-34
lines changed

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ jobs:
4040
strategy:
4141
fail-fast: false
4242
matrix:
43-
os: [ubuntu-20.04, windows-2019, macos-12]
43+
os: [ubuntu-20.04, windows-2019, macos-13]
4444

4545
steps:
4646
- name: Checkout source
47-
uses: actions/checkout@v3
47+
uses: actions/checkout@v4
4848

4949
- uses: msys2/setup-msys2@v2
5050
if: matrix.os == 'windows-2019'

CHANGES.rst

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,30 @@ Changelog of threedigrid-builder
22
================================
33

44

5-
1.21.1 (unreleased)
5+
1.21.4 (unreleased)
66
-------------------
77

88
- Remove internal changes made for previous schema upgrades and limit changes to db interface
99

1010

11+
1.21.3 (2024-12-17)
12+
-------------------
13+
14+
- Fix creating cross sections with schema 228
15+
16+
17+
1.21.2 (2024-12-17)
18+
-------------------
19+
20+
- Set MacOs release version to 13 to fix build
21+
22+
23+
1.21.1 (2024-12-12)
24+
-------------------
25+
26+
- Fix total discharge boundary type for groundwater not being properly defined.
27+
28+
1129
1.21.0 (2024-11-25)
1230
-------------------
1331

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ requires = [
55
"wheel",
66
"cmake>=3.18",
77
"scikit-build",
8-
"numpy==1.17.3; python_version=='3.8'",
98
"numpy==1.19.3; python_version=='3.9'",
109
"numpy==1.21.3; python_version=='3.10'",
1110
"numpy==1.24.2; python_version=='3.11'",

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def get_version():
8585
"gpkg": ["geopandas"],
8686
"cli": ["typer"],
8787
},
88-
python_requires=">=3.8",
88+
python_requires=">=3.9",
8989
include_package_data=True,
9090
classifiers=[
9191
"Programming Language :: Python :: 3",

threedigrid_builder/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
from .exceptions import * # NOQA
33

44
# fmt: off
5-
__version__ = '1.21.1.dev0'
5+
__version__ = '1.21.4.dev0'
66
# fmt: on

threedigrid_builder/grid/boundary_conditions.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@
1818

1919

2020
GROUNDWATER_BOUNDARY_TYPES = frozenset(
21-
{BoundaryType.GROUNDWATERLEVEL, BoundaryType.GROUNDWATERDISCHARGE}
21+
{
22+
BoundaryType.GROUNDWATERLEVEL,
23+
BoundaryType.GROUNDWATERDISCHARGE,
24+
BoundaryType.GROUNDWATER_TOTAL_DISCHARGE_2D,
25+
}
2226
)
2327

2428

@@ -270,6 +274,7 @@ def boundary_type_is_groundwater(type: BoundaryType) -> bool:
270274
return type in {
271275
BoundaryType.GROUNDWATERLEVEL,
272276
BoundaryType.GROUNDWATERDISCHARGE,
277+
BoundaryType.GROUNDWATER_TOTAL_DISCHARGE_2D,
273278
}
274279

275280
def check_edge_coord(

threedigrid_builder/grid/cross_section_definitions.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,10 @@ def get_unique(self):
6565
[getattr(self, attr)[mask] for attr in cross_section_attributes[shape]]
6666
)
6767
# Find unique rows and add these to the new_csd_dict with new id's
68-
u_arr, u_idx = np.unique(attr_arr, return_index=True)
68+
if len(cross_section_attributes[shape]) > 1:
69+
u_arr, u_idx = np.unique(attr_arr, axis=0, return_index=True)
70+
else:
71+
u_arr, u_idx = np.unique(attr_arr, return_index=True)
6972
new_id = np.arange(len(u_idx)) + len(new_csd_dict["id"])
7073
for key in new_csd_dict:
7174
if key == "id":

threedigrid_builder/tests/test_boundary_conditions.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,12 @@ def grid2d_gw():
366366
LineType.LINE_2D_BOUNDARY_EAST,
367367
(1, 9),
368368
),
369+
(
370+
BoundaryType.TOTAL_DISCHARGE_2D,
371+
NodeType.NODE_2D_BOUNDARIES,
372+
LineType.LINE_2D_BOUNDARY_EAST,
373+
(1, 9),
374+
),
369375
(
370376
BoundaryType.GROUNDWATERLEVEL,
371377
NodeType.NODE_2D_GROUNDWATER_BOUNDARIES,
@@ -378,6 +384,12 @@ def grid2d_gw():
378384
LineType.LINE_2D_GROUNDWATER_BOUNDARY_EAST,
379385
(3, 9),
380386
),
387+
(
388+
BoundaryType.GROUNDWATER_TOTAL_DISCHARGE_2D,
389+
NodeType.NODE_2D_GROUNDWATER_BOUNDARIES,
390+
LineType.LINE_2D_GROUNDWATER_BOUNDARY_EAST,
391+
(3, 9),
392+
),
381393
],
382394
)
383395
def test_2d_boundary_condition_types(grid2d_gw, boundary_type, node_type, kcu, line):

threedigrid_builder/tests/test_cross_section_definitions.py

Lines changed: 22 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -515,27 +515,23 @@ def test_tabulate_yz_err(width, height, match):
515515
class TestCrossSectionDefinitionGetUnique:
516516
def test_for_closed_rectangle(self):
517517
csd_in = CrossSectionDefinitions(
518-
id=[100, 200],
518+
id=[100, 200, 300, 400],
519519
shape=[
520520
constants.CrossSectionShape.CLOSED_RECTANGLE.value,
521521
constants.CrossSectionShape.CLOSED_RECTANGLE.value,
522+
constants.CrossSectionShape.CLOSED_RECTANGLE.value,
523+
constants.CrossSectionShape.CLOSED_RECTANGLE.value,
522524
],
523-
width=[1, 1],
524-
height=[1, 1],
525-
cross_section_table=["foo", "bar"],
526-
origin_table=["pipe", "weir"],
527-
origin_id=[10, 20],
525+
width=[1, 3, 1, 3],
526+
height=[1, 2, 1, 2],
527+
cross_section_table=["foo", "bar", "foo", "bar"],
528+
origin_table=["pipe", "weir", "pipe", "pipe"],
529+
origin_id=[10, 20, 30, 40],
528530
)
529531
unique_definition, _ = csd_in.get_unique()
530-
assert unique_definition.id == [
531-
0,
532-
]
533-
assert unique_definition.width == [
534-
1,
535-
]
536-
assert unique_definition.height == [
537-
1,
538-
]
532+
np.testing.assert_array_equal(unique_definition.id, [0, 1])
533+
np.testing.assert_array_equal(unique_definition.width, [1, 3])
534+
np.testing.assert_array_equal(unique_definition.height, [1, 2])
539535

540536
@pytest.mark.parametrize(
541537
"shape",
@@ -574,19 +570,19 @@ def test_for_tabulated_shape(self, shape):
574570
)
575571
def test_for_other_shapes(self, shape):
576572
csd_in = CrossSectionDefinitions(
577-
id=[100, 200],
578-
shape=[shape, shape],
579-
width=[1, 1],
580-
height=[10, 21],
581-
cross_section_table=["foo", "foo"],
582-
origin_table=["pipe", "weir"],
583-
origin_id=[10, 20],
573+
id=[100, 200, 300],
574+
shape=[shape, shape, shape],
575+
width=[1, 1, 100],
576+
height=[10, 21, 100],
577+
cross_section_table=["foo", "foo", "bar"],
578+
origin_table=["pipe", "weir", "weir"],
579+
origin_id=[10, 20, 30],
584580
)
585581
unique_definition, _ = csd_in.get_unique()
586-
assert unique_definition.id == [
587-
0,
588-
]
589-
assert unique_definition.cross_section_table == ["foo"]
582+
np.testing.assert_array_equal(unique_definition.id, [0, 1])
583+
np.testing.assert_array_equal(
584+
sorted(unique_definition.cross_section_table), sorted(["foo", "bar"])
585+
)
590586

591587
def test_mapping(self):
592588
csd_in = CrossSectionDefinitions(

0 commit comments

Comments
 (0)