ee.Array.and

On an element-wise basis, returns 1 iff both values are non-zero.

UsageReturns
Array.and(right)Array
ArgumentTypeDetails
this: leftArray

The left-hand value.

rightArray

The right-hand value.

Examples

JavaScript

// Element-wise boolean "and" operator.
// Both arrays must be the same dimensions.
var arrayNeither = ee.Array([0, 0]);
var arrayFirst = ee.Array([1, 0]);
var arraySecond = ee.Array([0, 1]);
var arrayBoth = ee.Array([1, 1]);
// Any non-zero value is true.
var arrayLarger = ee.Array([-2, 2]);

print(arrayBoth.and(arrayLarger));  // [1, 1]
print(arrayBoth.and(arrayNeither));  // [0, 0]

print(arrayFirst.and(arraySecond));  // [0, 0]
print(arraySecond.and(arrayFirst));  // [0, 0]

print(arrayBoth.and(arrayFirst));  // [1, 0]
print(arrayBoth.and(arraySecond));  // [0, 1]

print(arrayNeither.and(arrayFirst));  // [0, 0]
print(arrayNeither.and(arraySecond));  // [0, 0]

// Works the same for all PixelTypes.
var arrayDouble = ee.Array([0.0, 2.0], ee.PixelType.double());
print(arrayBoth.and(arrayDouble));  // [0, 1]

Python

# Your example goes here!