|
26 | 26 | dsg,
|
27 | 27 | flag_excl,
|
28 | 28 | flag_indep,
|
| 29 | + flag_indep_uint16, |
29 | 30 | flag_mix,
|
30 | 31 | forecast,
|
31 | 32 | mollwds,
|
@@ -164,6 +165,7 @@ def test_repr() -> None:
|
164 | 165 | # Flag DataArray
|
165 | 166 | assert "Flag Variable" in repr(flag_excl.cf)
|
166 | 167 | assert "Flag Variable" in repr(flag_indep.cf)
|
| 168 | + assert "Flag Variable" in repr(flag_indep_uint16.cf) |
167 | 169 | assert "Flag Variable" in repr(flag_mix.cf)
|
168 | 170 | assert "Flag Variable" in repr(basin.cf)
|
169 | 171 |
|
@@ -1837,6 +1839,30 @@ def test_flag_indep(self) -> None:
|
1837 | 1839 | res = flag_indep.cf.flags[name]
|
1838 | 1840 | np.testing.assert_equal(res.to_numpy(), expected[i])
|
1839 | 1841 |
|
| 1842 | + def test_flag_indep_uint16(self) -> None: |
| 1843 | + expected = [ |
| 1844 | + [True, False, False, False, False, True], # bit 1 |
| 1845 | + [False, True, False, False, False, True], # bit 2 |
| 1846 | + [False, False, True, False, False, True], # bit 4 |
| 1847 | + [False, True, False, True, False, True], # bit 8 |
| 1848 | + [False, False, False, False, True, True], # bit 16 |
| 1849 | + [False, False, True, True, False, True], # bit 32 |
| 1850 | + [False, False, True, True, False, True], # bit 64 |
| 1851 | + [False, False, False, True, False, True], # bit 128 |
| 1852 | + [False, False, False, True, True, True], # bit 256 |
| 1853 | + [False, False, False, True, True, True], # bit 512 |
| 1854 | + [False, False, False, False, True, True], # bit 1024 |
| 1855 | + [False, False, False, False, False, True], # bit 2048 |
| 1856 | + [False, False, False, False, False, True], # bit 4096 |
| 1857 | + [False, False, False, False, True, True], # bit 8192 |
| 1858 | + [False, False, False, False, False, True], # bit 16384 |
| 1859 | + [False, False, False, False, False, True], # bit 32768 |
| 1860 | + ] |
| 1861 | + for i in range(16): |
| 1862 | + name = f"flag_{2**i}" |
| 1863 | + res = flag_indep_uint16.cf.flags[name] |
| 1864 | + np.testing.assert_equal(res.to_numpy(), expected[i]) |
| 1865 | + |
1840 | 1866 | def test_flag_mix(self) -> None:
|
1841 | 1867 | expected = [
|
1842 | 1868 | [False, False, True, True, False, False, True, True], # flag 1
|
@@ -1983,6 +2009,7 @@ def plane(coords, slopex, slopey):
|
1983 | 2009 | [basin, "Flag Variable"],
|
1984 | 2010 | [flag_mix, "Flag Variable"],
|
1985 | 2011 | [flag_indep, "Flag Variable"],
|
| 2012 | + [flag_indep_uint16, "Flag Variable"], |
1986 | 2013 | [flag_excl, "Flag Variable"],
|
1987 | 2014 | [dsg, "Discrete Sampling Geometry"],
|
1988 | 2015 | ),
|
|
0 commit comments