ee.Number.rightShift

计算 v1 按 v2 位进行的有符号右移。

用法返回
Number.rightShift(right)数字
参数类型详细信息
此:left数字左侧值。
right数字右侧值。

示例

代码编辑器 (JavaScript)

/**
 * Unsigned 8-bit type example.
 *
 * 20 as binary:   00010100
 * Right shift 2:  00000101
 *
 * 00000101 is binary for 5.
 */

print(ee.Number(20).rightShift(2));  // 5

Python 设置

如需了解 Python API 和如何使用 geemap 进行交互式开发,请参阅 Python 环境页面。

import ee
import geemap.core as geemap

Colab (Python)

"""Unsigned 8-bit type example.

20 as binary:   00010100
Right shift 2:  00000101

00000101 is binary for 5.
"""

print(ee.Number(20).rightShift(2).getInfo())  # 5