Commit f6c8a1f
Add larger bit depth for displaying flag_masks (#492)
* Add flag_mask formatting support for bitdepth greater than uint8
Underlying cf flag_mask codes (eg. == and .isin) work with
flag_masks with more than 8 independent flags (eg. uint32), however
the formatting codes that print messages to the screen are limited
to uint8. Add/modify functions to unpack bits from larger integer
dtypes.
* Edit fixed-width formatting for larger bit depth flag_masks
Original formatting widths work well for 8-bit flag_masks, but need
some modification for larger integer values.
* Fix bit_length calculating multiple times
bit_length is re-calculated a second time inside _unpacked_bits,
which can lead to incorrect bit_length. Pass this value as an
argument instead, since it was properly calculated earlier in
the process.
* Remove unsigned integer check
Flags do not have to be unsigned. For example, "basin" test dataset
will fail the unsigned integer test even though it contains valid
int64 flags.
* Add test for 16bit version of flag_masks
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Add flag_indep_uint16 example dataset
* One more test
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Deepak Cherian <deepak@cherian.net>1 parent c2f2540 commit f6c8a1f
3 files changed
Lines changed: 92 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
503 | 503 | | |
504 | 504 | | |
505 | 505 | | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
506 | 516 | | |
507 | 517 | | |
508 | 518 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
154 | | - | |
155 | | - | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
156 | 195 | | |
157 | 196 | | |
158 | 197 | | |
| |||
161 | 200 | | |
162 | 201 | | |
163 | 202 | | |
164 | | - | |
165 | | - | |
| 203 | + | |
| 204 | + | |
166 | 205 | | |
167 | 206 | | |
168 | 207 | | |
| |||
184 | 223 | | |
185 | 224 | | |
186 | 225 | | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
187 | 231 | | |
188 | 232 | | |
189 | 233 | | |
190 | 234 | | |
191 | 235 | | |
192 | 236 | | |
193 | 237 | | |
194 | | - | |
195 | | - | |
| 238 | + | |
| 239 | + | |
196 | 240 | | |
197 | 241 | | |
198 | 242 | | |
199 | 243 | | |
200 | 244 | | |
201 | 245 | | |
202 | 246 | | |
203 | | - | |
| 247 | + | |
204 | 248 | | |
205 | | - | |
| 249 | + | |
206 | 250 | | |
207 | 251 | | |
208 | 252 | | |
| |||
230 | 274 | | |
231 | 275 | | |
232 | 276 | | |
233 | | - | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
234 | 280 | | |
235 | 281 | | |
236 | 282 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| |||
164 | 165 | | |
165 | 166 | | |
166 | 167 | | |
| 168 | + | |
167 | 169 | | |
168 | 170 | | |
169 | 171 | | |
| |||
1837 | 1839 | | |
1838 | 1840 | | |
1839 | 1841 | | |
| 1842 | + | |
| 1843 | + | |
| 1844 | + | |
| 1845 | + | |
| 1846 | + | |
| 1847 | + | |
| 1848 | + | |
| 1849 | + | |
| 1850 | + | |
| 1851 | + | |
| 1852 | + | |
| 1853 | + | |
| 1854 | + | |
| 1855 | + | |
| 1856 | + | |
| 1857 | + | |
| 1858 | + | |
| 1859 | + | |
| 1860 | + | |
| 1861 | + | |
| 1862 | + | |
| 1863 | + | |
| 1864 | + | |
| 1865 | + | |
1840 | 1866 | | |
1841 | 1867 | | |
1842 | 1868 | | |
| |||
1983 | 2009 | | |
1984 | 2010 | | |
1985 | 2011 | | |
| 2012 | + | |
1986 | 2013 | | |
1987 | 2014 | | |
1988 | 2015 | | |
| |||
0 commit comments