ee.Array.not

  • The not() function returns 0 for non-zero inputs and 1 for zero inputs on an element-wise basis.

  • It operates on an input array and returns an array.

  • The input must be an Array type.

  • Examples in JavaScript and Python demonstrate the function's behavior with various array inputs, including an empty array and arrays with zero, non-zero, and a mix of values.

On an element-wise basis, returns 0 if the input is non-zero, and 1 otherwise.

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

Examples

Code Editor (JavaScript)

var empty = ee.Array([], ee.PixelType.int8());
print(empty.not());  // []

print(ee.Array([0]).not());  // [1]
print(ee.Array([1]).not());  // [0]

print(ee.Array([-1, -0.1, 0, 0.1, 1]).not());  // [0,0,1,0,0]

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)

empty = ee.Array([], ee.PixelType.int8())
display(empty.Not())  # []

display(ee.Array([0]).Not())  # [1]
display(ee.Array([1]).Not())  # [0]

display(ee.Array([-1, -0.1, 0, 0.1, 1]).Not())  # [0, 0, 1, 0, 0]