Skip to content

Commit 2c37db0

Browse files
committed
Update test_validation.py with global_val of a masked array
1 parent bd32530 commit 2c37db0

1 file changed

Lines changed: 21 additions & 2 deletions

File tree

openpiv/test/test_validation.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,30 @@ def test_global_val(N=2,U=(-10,10)):
144144
u = np.random.rand(2*N+1, 2*N+1)
145145
u[N, N] = U[0]-.1
146146
u[0,0] = U[1]+.1
147+
148+
v = np.ma.masked_array(u.copy(), np.ma.nomask)
149+
v[N+1,N+1] = np.ma.masked
150+
151+
147152
print('\n\n\n')
148-
print(u)
153+
print(u)
154+
print(v.data)
155+
print(v.mask)
149156

150157
u1, _, mask = validation.global_val(u,u,U,U)
151158
assert np.isnan(u1[N,N])
152159
assert np.isnan(u1[0,0])
153160
assert mask[N,N]
154-
assert mask[0,0]
161+
assert mask[0,0]
162+
163+
# masked array test
164+
165+
166+
167+
v1, _, mask1 = validation.global_val(v,v,U,U)
168+
assert isinstance(v1,np.ma.MaskedArray)
169+
assert np.isnan(v1.data[N,N])
170+
assert np.isnan(v1.data[0,0])
171+
print(mask1)
172+
assert mask1[N,N]
173+
assert mask1[0,0]

0 commit comments

Comments
 (0)