Announcement: All noncommercial projects registered to use Earth Engine beforeApril 15, 2025 mustverify noncommercial eligibility to maintain access. If you have not verified by September 26, 2025, your access may be on hold.

ee.Array.bitwiseNot

  • ThebitwiseNot() method calculates the bitwise NOT of each element in an input array.

  • It returns an array of the same dimensions as the input array, with the bitwise NOT applied element-wise.

  • The bitwise NOT is calculated in the smallest signed integer type that can hold the input.

On an element-wise basis, calculates the bitwise NOT of the input, in the smallest signed integer type that can hold the input.

UsageReturns
Array.bitwiseNot()Array
ArgumentTypeDetails
this:inputArrayThe input array.

Examples

Code Editor (JavaScript)

varempty=ee.Array([],ee.PixelType.int8());print(empty.bitwiseNot());// []print(ee.Array(0).bitwiseNot());// -1print(ee.Array(1).bitwiseNot());// -2print(ee.Array(0xFF).bitwiseNot());// -256print(ee.Array(-1).bitwiseNot());// 0print(ee.Array(-2).bitwiseNot());// 1print(ee.Array(-3).bitwiseNot());// 2print(ee.Array(0xFF).toInt64().bitwiseNot());// -256

Python setup

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

importeeimportgeemap.coreasgeemap

Colab (Python)

empty=ee.Array([],ee.PixelType.int8())display(empty.bitwiseNot())# []display(ee.Array(0).bitwiseNot())# -1display(ee.Array(1).bitwiseNot())# -2display(ee.Array(0xFF).bitwiseNot())# -256display(ee.Array(-1).bitwiseNot())# 0display(ee.Array(-2).bitwiseNot())# 1display(ee.Array(-3).bitwiseNot())# 2display(ee.Array(0xFF).toInt64().bitwiseNot())# -256

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2023-10-06 UTC.