Skip to content

Commit dc53aad

Browse files
committed
use 1 based indexing for node and element ids in new node masking tests, add back some missing symbols
1 parent 8f61f6a commit dc53aad

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

src/addon/esmpy/src/esmpy/test/test_api/test_mesh.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
from esmpy.util.mesh_utilities import *
2020
from numpy.testing import assert_array_equal
2121

22+
from esmpy.api.constants import FileFormat
2223

2324
@pytest.mark.parametrize(
2425
"mask_value",
@@ -31,6 +32,7 @@
3132
[[0, 0, 0, 0], [-1, -1, -1, -1], [1, 1, 1, 1]],
3233
),
3334
)
35+
3436
def test_add_nodes_with_mask(mask_value):
3537
"""Check adding masked nodes to a mesh."""
3638
if mask_value is None:
@@ -44,7 +46,7 @@ def test_add_nodes_with_mask(mask_value):
4446

4547
mesh.add_nodes(
4648
len(xy_of_points),
47-
np.arange(len(xy_of_points)),
49+
np.arange(len(xy_of_points))+1, #PR204 esmpy currently uses 1-based indexing for mesh node ids
4850
xy_of_points,
4951
np.zeros(len(xy_of_points), dtype=int),
5052
node_mask=mask,
@@ -67,7 +69,7 @@ def test_add_nodes_with_mask_bad():
6769
with pytest.raises(ValueError):
6870
mesh.add_nodes(
6971
len(xy_of_points),
70-
np.arange(len(xy_of_points)),
72+
np.arange(len(xy_of_points))+1, #PR204 esmpy currently uses 1-based indexing for mesh node ids
7173
xy_of_points,
7274
np.zeros(len(xy_of_points), dtype=int),
7375
node_mask=[1, 2, 3],

src/addon/esmpy/src/esmpy/test/test_api/test_regrid.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from esmpy.api.constants import _ESMF_PIO
1111
from esmpy.api.constants import _ESMF_USE_INMEM_FACTORS
1212
from esmpy.api.constants import CoordSys
13+
from esmpy.api.constants import GridItem
1314
from esmpy.api.constants import LineType
1415
from esmpy.api.constants import Region
1516
from esmpy.api.constants import StaggerLoc
@@ -23,6 +24,7 @@
2324
from esmpy.api.mesh import MeshElemType
2425
from esmpy.api.mesh import MeshLoc
2526
from esmpy.api.regrid import Regrid
27+
from esmpy.api.regrid import RegridFromFile
2628
from esmpy.api.regrid import RegridMethod
2729
from esmpy.test.base import TestBase
2830
from esmpy.util.cache_data import DATA_DIR
@@ -82,18 +84,18 @@ def create_raster_field(x_of_col, y_of_row, node_mask=None):
8284

8385
mesh.add_nodes(
8486
n_points,
85-
id_of_point.flatten(),
87+
id_of_point.flatten()+1, #PR204 esmpy currently uses 1-based indexing for mesh node ids
8688
xy_of_point.flatten(),
8789
np.zeros(n_points, dtype=int),
8890
node_mask=node_mask,
8991
)
9092

9193
mesh.add_elements(
9294
n_elements,
93-
np.arange(n_elements, dtype=int),
95+
np.arange(n_elements, dtype=int)+1, #PR204 esmpy currently uses 1-based indexing for mesh element ids
9496
np.full(n_elements, MeshElemType.QUAD, dtype=int),
9597
points_at_element,
96-
xy_of_element,
98+
xy_of_element, #PR204 this is an optional parameter, should use a keyword to specify which desired
9799
)
98100

99101
return Field(mesh, meshloc=MeshLoc.NODE)

0 commit comments

Comments
 (0)