ee.Number.ceil

  • Computes the smallest integer greater than or equal to the input number.

  • The Number.ceil() function takes a Number as input and returns a Number representing the ceiling value.

  • Examples demonstrate the function's use with both positive and negative numbers in JavaScript and Python.

Computes the smallest integer greater than or equal to the input.
Usage Returns
Number. ceil () Number
Argument Type Details
this: input
Number The input value.

Examples

Code Editor (JavaScript)

 // Positive numbers. 
 print 
 ( 
 'Ceiling for 2.1' 
 , 
  
 ee 
 . 
 Number 
 ( 
 2.1 
 ). 
 ceil 
 ()); 
  
 // 3 
 print 
 ( 
 'Ceiling for 2.5' 
 , 
  
 ee 
 . 
 Number 
 ( 
 2.5 
 ). 
 ceil 
 ()); 
  
 // 3 
 print 
 ( 
 'Ceiling for 2.9' 
 , 
  
 ee 
 . 
 Number 
 ( 
 2.9 
 ). 
 ceil 
 ()); 
  
 // 3 
 // Negative numbers. 
 print 
 ( 
 'Ceiling for 2.1' 
 , 
  
 ee 
 . 
 Number 
 ( 
 - 
 2.1 
 ). 
 ceil 
 ()); 
  
 // -2 
 print 
 ( 
 'Ceiling for 2.5' 
 , 
  
 ee 
 . 
 Number 
 ( 
 - 
 2.5 
 ). 
 ceil 
 ()); 
  
 // -2 
 print 
 ( 
 'Ceiling for 2.9' 
 , 
  
 ee 
 . 
 Number 
 ( 
 - 
 2.9 
 ). 
 ceil 
 ()); 
  
 // -2 

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)

 # Positive numbers. 
 display 
 ( 
 'Ceiling for 2.1:' 
 , 
 ee 
 . 
 Number 
 ( 
 2.1 
 ) 
 . 
 ceil 
 ()) 
 # 3 
 display 
 ( 
 'Ceiling for 2.5:' 
 , 
 ee 
 . 
 Number 
 ( 
 2.5 
 ) 
 . 
 ceil 
 ()) 
 # 3 
 display 
 ( 
 'Ceiling for 2.9:' 
 , 
 ee 
 . 
 Number 
 ( 
 2.9 
 ) 
 . 
 ceil 
 ()) 
 # 3 
 # Negative numbers. 
 display 
 ( 
 'Ceiling for 2.1:' 
 , 
 ee 
 . 
 Number 
 ( 
 - 
 2.1 
 ) 
 . 
 ceil 
 ()) 
 # -2 
 display 
 ( 
 'Ceiling for 2.5:' 
 , 
 ee 
 . 
 Number 
 ( 
 - 
 2.5 
 ) 
 . 
 ceil 
 ()) 
 # -2 
 display 
 ( 
 'Ceiling for 2.9:' 
 , 
 ee 
 . 
 Number 
 ( 
 - 
 2.9 
 ) 
 . 
 ceil 
 ()) 
 # -2 
Design a Mobile Site
View Site in Mobile | Classic
Share by: