read_bit_array#
- read_bit_array(bit_mask: ndarray, bit_id: list | int) ndarray | list [source]#
Read bit arrays as a succession of binary masks (sort of read a slice of the bit mask, slice number bit_id)
- Parameters:
bit_mask (np.ndarray) – Bit array to read
bit_id (int) – Bit ID of the slice to be read Example: read the bit 0 of the mask as a cloud mask (Theia)
- Returns:
Binary mask or list of binary masks if a list of bit_id is given
- Return type:
Union[np.ndarray, list]
Example
>>> bit_array = np.random.randint(5, size=[3,3]) array([[1, 1, 3], [4, 2, 0], [4, 3, 2]], dtype=uint8)
>>> # Get the 2nd bit array >>> read_bit_array(bit_array, 2) array([[0, 0, 0], [1, 0, 0], [1, 0, 0]], dtype=uint8)