ee.Array.max

On an element-wise basis, selects the maximum of the first and second values.
Usage Returns
Array. max (right) Array
Argument Type Details
this: left
Array The left-hand value.
right
Array The right-hand value.

Examples

Code Editor (JavaScript)

 var 
  
 empty 
  
 = 
  
 ee 
 . 
 Array 
 ([], 
  
 ee 
 . 
 PixelType 
 . 
 int8 
 ()); 
 print 
 ( 
 empty 
 . 
 max 
 ( 
 empty 
 )); 
  
 // [] 
 var 
  
 array1 
  
 = 
  
 ee 
 . 
 Array 
 ([ 
 0 
 , 
  
 - 
 3 
 , 
  
 5 
 , 
  
 3 
 ]); 
 var 
  
 array2 
  
 = 
  
 ee 
 . 
 Array 
 ([ 
 0 
 , 
  
 - 
 1 
 , 
  
 2 
 , 
  
 4 
 ]); 
 print 
 ( 
 array1 
 . 
 max 
 ( 
 array2 
 )); 
  
 // [0,-1,5,4] 

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 
 . 
 max 
 ( 
 empty 
 )) 
 # [] 
 array1 
 = 
 ee 
 . 
 Array 
 ([ 
 0 
 , 
 - 
 3 
 , 
 5 
 , 
 3 
 ]) 
 array2 
 = 
 ee 
 . 
 Array 
 ([ 
 0 
 , 
 - 
 1 
 , 
 2 
 , 
 4 
 ]) 
 display 
 ( 
 array1 
 . 
 max 
 ( 
 array2 
 )) 
 # [0, -1, 5, 4] 
Create a Mobile Website
View Site in Mobile | Classic
Share by: