ee.Number.ceil

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

UsageReturns
Number.ceil()Number
ArgumentTypeDetails
this: inputNumberThe 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.
print('Ceiling for 2.1:', ee.Number(2.1).ceil().getInfo())  # 3
print('Ceiling for 2.5:', ee.Number(2.5).ceil().getInfo())  # 3
print('Ceiling for 2.9:', ee.Number(2.9).ceil().getInfo())  # 3

# Negative numbers.
print('Ceiling for 2.1:', ee.Number(-2.1).ceil().getInfo())  # -2
print('Ceiling for 2.5:', ee.Number(-2.5).ceil().getInfo())  # -2
print('Ceiling for 2.9:', ee.Number(-2.9).ceil().getInfo())  # -2