AI-generated Key Takeaways
-
ee.Array.bitsToArray(input)converts the bits of an integer input into an array. -
The resulting array has elements corresponding to the position of the highest set bit, or a single 0 for an input of 0.
-
The function returns an Array type.
-
The input argument is a Number representing the integer to transform.
| Usage | Returns |
|---|---|
ee.Array.bitsToArray(input) | Array |
| Argument | Type | Details |
|---|---|---|
input | Number | The integer to transform. |
Examples
Code Editor (JavaScript)
print(ee.Array.bitsToArray(0)); // [0] print(ee.Array.bitsToArray(1)); // [1] print(ee.Array.bitsToArray(5)); // [1, 0 , 1] print(ee.Array.bitsToArray(0xFF)); // [1,1,1,1,1,1,1,1] print(ee.Array.bitsToArray(-1)); // Array of 64 "1" values print(ee.Array.bitsToArray(-1).toInt8()); // Array of 64 "1" values
import ee import geemap.core as geemap
Colab (Python)
display(ee.Array.bitsToArray(0)) # [0] display(ee.Array.bitsToArray(1)) # [1] display(ee.Array.bitsToArray(5)) # [1, 0 , 1] display(ee.Array.bitsToArray(0xFF)) # [1, 1, 1, 1, 1, 1, 1, 1] display(ee.Array.bitsToArray(-1)) # Array of 64 "1" values display(ee.Array.bitsToArray(-1).toInt8()) # Array of 64 "1" values