Skip to content

Commit 6ef7193

Browse files
committed
update docstring for Mesh.add_nodes
1 parent 02ba34d commit 6ef7193

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

src/addon/esmpy/src/esmpy/api/mesh.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,13 @@ def add_nodes(self, node_count,
495495
tuples into a numpy array that correspond to node_ids.
496496
:param ndarray node_owners: a numpy array of shape (node_count, 1) to
497497
specify the rank of the processor that owns each node.
498+
499+
*OPTIONAL:*
500+
501+
:param ndarray node_mask: a numpy array of shape
502+
``(node_count, 1)`` containing integer values to specify masked
503+
nodes. The specific values that are masked are specified in the
504+
:class:`~esmpy.api.regrid.Regrid` constructor.
498505
"""
499506

500507
self._node_count = node_count

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
),
3333
)
3434
def test_add_nodes_with_mask(mask_value):
35+
"""Check adding masked nodes to a mesh."""
3536
if mask_value is None:
3637
mask = None
3738
else:
@@ -57,6 +58,7 @@ def test_add_nodes_with_mask(mask_value):
5758

5859

5960
def test_add_nodes_with_mask_bad():
61+
"""Check that adding a mask with an incorrect size raises an error."""
6062
mesh = Mesh(parametric_dim=2, spatial_dim=2, coord_sys=CoordSys.CART)
6163

6264
x_of_points, y_of_points = np.meshgrid([0.0, 1.0, 2.0, 3.0], [0.0, 1.0, 2.0])

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ def test_regrid_with_const_node_mask(mask_value, method):
143143
)
144144
@pytest.mark.parametrize("method", NON_CONSERVATIVE_METHODS)
145145
def test_regrid_with_node_mask(mask, method):
146+
"""Check that unmasked nodes are regridded and masked nodes remain unchanged."""
146147
src = create_raster_field([0.0, 1.0, 2.0, 3.0], [0.0, 1.0, 2.0], node_mask=mask)
147148
dst = create_raster_field([0.0, 1.0, 2.0, 3.0], [0.0, 1.0, 2.0], node_mask=mask)
148149
src.data[:] = 100.0
@@ -168,6 +169,7 @@ def test_regrid_with_node_mask(mask, method):
168169

169170
@pytest.mark.parametrize("method", NON_CONSERVATIVE_METHODS)
170171
def test_regrid_with_random_node_mask(method):
172+
"""Check regridding that masks random input data."""
171173
n_rows, n_cols = 100, 200
172174

173175
src_data = np.random.uniform(-1.0, 1.0, size=n_rows * n_cols)
@@ -201,6 +203,7 @@ def test_regrid_with_random_node_mask(method):
201203

202204
@pytest.mark.parametrize("method", NON_CONSERVATIVE_METHODS)
203205
def test_regrid_with_multivalued_node_mask(method):
206+
"""Check regridding that masks multiple values."""
204207
n_rows, n_cols = 100, 200
205208

206209
src_data = np.random.uniform(-1.0, 1.0, size=n_rows * n_cols)

0 commit comments

Comments
 (0)