Announcement: All noncommercial projects registered to use Earth Engine before April 15, 2025 must verify noncommercial eligibility to maintain access. If you have not verified by September 26, 2025, your access may be on hold.
ee.Date.unitRatio
Stay organized with collections
Save and categorize content based on your preferences.
AI-generated Key Takeaways
The unitRatio function returns the ratio of the length of one time unit to another.
Valid time units for the function are year, month, week, day, hour, minute, and second.
The function takes two string arguments, numerator and denominator, representing the units to compare.
The output of the function is a floating-point number representing the calculated ratio.
Returns the ratio of the length of one unit to the length of another, e.g., unitRatio('day', 'minute') returns 1440. Valid units are 'year', 'month', 'week', 'day', 'hour', 'minute', and 'second'.
[null,null,["Last updated 2025-06-23 UTC."],[],["The `unitRatio` function calculates the ratio between two time units. It accepts two string arguments: `numerator` and `denominator`, representing the desired units. Valid time units include 'year', 'month', 'week', 'day', 'hour', 'minute', and 'second'. The function returns a float value representing the ratio of the numerator to the denominator (e.g., how many minutes are in a day). Examples are provided in JavaScript and Python demonstrating various unit conversions.\n"]]