ee.Date.unitRatio

Trả về tỷ lệ độ dài của một đơn vị so với độ dài của một đơn vị khác, ví dụ: unitRatio('ngày', 'phút') trả về 1440. Các đơn vị hợp lệ là "năm", "tháng", "tuần", "ngày", "giờ", "phút" và "giây".

Cách sử dụngGiá trị trả về
ee.Date.unitRatio(numerator, denominator)Số thực dấu phẩy động
Đối sốLoạiThông tin chi tiết
numeratorChuỗi
denominatorChuỗi

Ví dụ

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

print('Minutes in a day', ee.Date.unitRatio('day', 'minute'));
print('Seconds in a year', ee.Date.unitRatio('year', 'second'));
print('Years in a month', ee.Date.unitRatio('month', 'year'));
print('Hours in a week', ee.Date.unitRatio('week', 'hour'));

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 hoạt động phát triển tương tác.

import ee
import geemap.core as geemap

Colab (Python)

display('Minutes in a day:', ee.Date.unitRatio('day', 'minute'))
display('Seconds in a year:', ee.Date.unitRatio('year', 'second'))
display('Years in a month:', ee.Date.unitRatio('month', 'year'))
display('Hours in a week:', ee.Date.unitRatio('week', 'hour'))