ee.Array.multiply

Stay organized with collections Save and categorize content based on your preferences.
On an element-wise basis, multiplies the first value by the second.

UsageReturns
Array.multiply(right)Array
ArgumentTypeDetails
this: leftArrayThe left-hand value.
rightArrayThe right-hand value.

Examples

Code Editor (JavaScript)

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

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

// [-1,8,-2,4.8]
print(ee.Array([1, -2, 2, 4]).multiply([-1, -4, -1, 1.2]));

// [-1,2,-2,-3]
print(ee.Array([1, -2, 2, 3]).multiply(-1));

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

Colab (Python)

print(ee.Array([1]).multiply(0).getInfo())  # [0]
print(ee.Array([1]).multiply(1).getInfo())  # [1]

print(ee.Array([1]).multiply([0]).getInfo())  # [0]
print(ee.Array([1]).multiply([1]).getInfo())  # [1]

# [-1, 8, -2, 4.8]
print(ee.Array([1, -2, 2, 4]).multiply([-1, -4, -1, 1.2]).getInfo())

# [-1, 2, -2, -3]
print(ee.Array([1, -2, 2, 3]).multiply(-1).getInfo())

empty = ee.Array([], ee.PixelType.int8())
print(empty.multiply(empty).getInfo())  # []