Skip to content

Commit 419a920

Browse files
committed
break out commented assert into skipped unit test around masking and deserialization
Signed-off-by: Jason T. Brown <[email protected]>
1 parent a71505d commit 419a920

File tree

1 file changed

+28
-6
lines changed

1 file changed

+28
-6
lines changed

pyrasterframes/src/main/python/tests/RasterFunctionsTests.py

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import numpy as np
2828
from numpy.testing import assert_equal
2929

30+
from unittest import skip
3031
from . import TestEnvironment
3132

3233

@@ -278,12 +279,7 @@ def test_mask_bits(self):
278279
mask_fill_df.select(rf_data_cells('mbb')).first()[0],
279280
16 - 4
280281
)
281-
# Unsure why this fails. mask_fill_tile.cells is all 42 unmasked.
282-
# self.assertEqual(mask_fill_tile.cells.mask.sum(), 4,
283-
# f'Expected {16 - 4} data values but got the masked tile:'
284-
# f'{mask_fill_tile}'
285-
# )
286-
#
282+
287283
# mask out 6816, 6900
288284
mask_med_hi_cir = df.withColumn('mask_cir_mh',
289285
rf_mask_by_bits('t', 'mask', 11, 2, [2, 3])) \
@@ -294,6 +290,32 @@ def test_mask_bits(self):
294290
5
295291
)
296292

293+
@skip('Issue #422 https://github.com/locationtech/rasterframes/issues/422')
294+
def test_mask_and_deser(self):
295+
# duplicates much of test_mask_bits but
296+
t = Tile(42 * np.ones((4, 4), 'uint16'), CellType.uint16())
297+
# with a varitey of known values
298+
mask = Tile(np.array([
299+
[1, 1, 2720, 2720],
300+
[1, 6816, 6816, 2756],
301+
[2720, 2720, 6900, 2720],
302+
[2720, 6900, 6816, 1]
303+
]), CellType('uint16raw'))
304+
305+
df = self.spark.createDataFrame([Row(t=t, mask=mask)])
306+
307+
# removes fill value 1
308+
mask_fill_df = df.select(rf_mask_by_bit('t', 'mask', 0, True).alias('mbb'))
309+
mask_fill_tile = mask_fill_df.first()['mbb']
310+
311+
self.assertTrue(mask_fill_tile.cell_type.has_no_data())
312+
313+
# Unsure why this fails. mask_fill_tile.cells is all 42 unmasked.
314+
self.assertEqual(mask_fill_tile.cells.mask.sum(), 4,
315+
f'Expected {16 - 4} data values but got the masked tile:'
316+
f'{mask_fill_tile}'
317+
)
318+
297319
def test_mask(self):
298320
from pyspark.sql import Row
299321
from pyrasterframes.rf_types import Tile, CellType

0 commit comments

Comments
 (0)