ee.Array.multiply
On an element-wise basis, multiplies the first value by the second.
Usage | Returns |
---|
Array.multiply(right) | Array |
Argument | Type | Details |
---|
this: left | Array | The left-hand value. |
right | Array | The right-hand value. |
Examples
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)); // []
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
display(ee.Array([1]).multiply(0)) # [0]
display(ee.Array([1]).multiply(1)) # [1]
display(ee.Array([1]).multiply([0])) # [0]
display(ee.Array([1]).multiply([1])) # [1]
# [-1, 8, -2, 4.8]
display(ee.Array([1, -2, 2, 4]).multiply([-1, -4, -1, 1.2]))
# [-1, 2, -2, -3]
display(ee.Array([1, -2, 2, 3]).multiply(-1))
empty = ee.Array([], ee.PixelType.int8())
display(empty.multiply(empty)) # []
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2023-10-06 UTC.
[null,null,["Last updated 2023-10-06 UTC."],[[["`Array.multiply()` performs element-wise multiplication between two arrays or an array and a number."],["The left-hand operand is the array the method is called on, and the right-hand operand can be an array or a number."],["If both operands are arrays, they must have the same number of elements."],["The result is a new array with the same dimensions as the inputs, where each element is the product of the corresponding elements in the inputs."],["If either operand is empty, the result is an empty array."]]],[]]