ee.Number.leftShift

Calculates the left shift of v1 by v2 bits.

UsageReturns
Number.leftShift(right)Number
ArgumentTypeDetails
this: leftNumberThe left-hand value.
rightNumberThe right-hand value.

Examples

Code Editor (JavaScript)

/**
 * Unsigned 8-bit type example.
 *
 * 20 as binary:  00010100
 * Left shift 2:  01010000
 *
 * 01010000 is binary for 80.
 */

print(ee.Number(20).leftShift(2));  // 80

Python setup

See the Python Environment page for information on the Python API and using geemap for interactive development.

import ee
import geemap.core as geemap

Colab (Python)

"""Unsigned 8-bit type example.

20 as binary:  00010100
Left shift 2:  01010000

01010000 is binary for 80.
"""

print(ee.Number(20).leftShift(2).getInfo())  # 80