ee.Number.round

Tính số nguyên gần nhất với số đầu vào.

Cách sử dụngGiá trị trả về
Number.round()Số
Đối sốLoạiThông tin chi tiết
this: inputSốGiá trị đầu vào.

Ví dụ

Trình soạn thảo mã (JavaScript)

print('10.4 rounds down', ee.Number(10.4).round());  // 10
print('10.5 rounds up', ee.Number(10.5).round());  // 11
print('10.9 rounds up', ee.Number(10.9).round());  // 11

Thiết lập Python

Hãy xem trang Môi trường Python để biết thông tin về API Python và cách sử dụng geemap cho quá trình phát triển tương tác.

import ee
import geemap.core as geemap

Colab (Python)

print('10.4 rounds down:', ee.Number(10.4).round().getInfo())  # 10
print('10.5 rounds up:', ee.Number(10.5).round().getInfo())  # 11
print('10.9 rounds up:', ee.Number(10.9).round().getInfo())  # 11