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.pow

  • TheArray.pow function raises the elements of the left-hand array to the power of the corresponding elements in the right-hand array.

  • The function takes two Array arguments,this: left andright, and returns an Array.

  • Examples are provided in both JavaScript and Python demonstrating the use ofArray.pow with various inputs.

On an element-wise basis, raises the first value to the power of the second.

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

Examples

Code Editor (JavaScript)

varempty=ee.Array([],ee.PixelType.int8());print(empty.pow(empty));// []// [0.25,-0.5,1,-2,4,-8]print(ee.Array([-2,-2,-2,-2,-2,-2]).pow([-2,-1,0,1,2,3]));// [1,-1,1,-1,1,-1]print(ee.Array([-1,-1,-1,-1,-1,-1]).pow([-2,-1,0,1,2,3]));// print(ee.Array([0, 0, 0, 0, 0, 0]).pow([-2, -1, 0, 1, 2, 3]));print(ee.Array([0,0,0,0]).pow([0,1,2,3]));// [1,1,1,1,1,1]print(ee.Array([1,1,1,1,1,1]).pow([-2,-1,0,1,2,3]));// [0.25,0.5,1,2,4,8]print(ee.Array([2,2,2,2,2,2]).pow([-2,-1,0,1,2,3]));// [0.009999999776482582,//  0.10000000149011612,//  1,//  10,//  100,//  1000]print(ee.Array([10,10,10,10,10,10]).pow([-2,-1,0,1,2,3]));// [0.009999999776482582,//  0.10000000149011612,//  1,//  10,//  100,//  1000]print(ee.Array([10,10,10,10,10,10],ee.PixelType.int32()).pow([-2,-1,0,1,2,3]));

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.pow(empty))# []# [0.25, -0.5, 1, -2, 4, -8]display(ee.Array([-2,-2,-2,-2,-2,-2]).pow([-2,-1,0,1,2,3]))# [1, -1, 1, -1, 1, -1]display(ee.Array([-1,-1,-1,-1,-1,-1]).pow([-2,-1,0,1,2,3]))# ['Infinity', 'Infinity', 1, 0, 0, 0]display(ee.Array([0,0,0,0,0,0]).pow([-2,-1,0,1,2,3]))# [1, 0, 0, 0]display(ee.Array([0,0,0,0]).pow([0,1,2,3]))# [1, 1, 1, 1, 1, 1]display(ee.Array([1,1,1,1,1,1]).pow([-2,-1,0,1,2,3]))# [0.25, 0.5, 1, 2, 4, 8]display(ee.Array([2,2,2,2,2,2]).pow([-2,-1,0,1,2,3]))# [0.009999999776482582,#  0.10000000149011612,#  1,#  10,#  100,#  1000]display(ee.Array([10,10,10,10,10,10]).pow([-2,-1,0,1,2,3]))# [0.009999999776482582,#  0.10000000149011612,#  1,#  10,#  100,#  1000]display(ee.Array([10,10,10,10,10,10],ee.PixelType.int32()).pow([-2,-1,0,1,2,3]))

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.