geetools.DateRange#

Extra tools for the ee.DateRange class.

Warning

As reported in gee-community/geetools#206, for user using earthengine-api<=0.1.388 this object cannot be extended before the API of Earth Enfine is initialized. So to use the following methods, you will be forced to manually import the following:

from geetools.DateRange import DateRangeAccessor

Package Contents#

Classes#

DateRangeAccessor

Toolbox for the ee.DateRange class.

class geetools.DateRange.DateRangeAccessor(obj)[source]#

Toolbox for the ee.DateRange class.

Initialize the DateRange class.

Parameters:

obj (ee.DateRange) –

static check_unit(unit)[source]#

Check if the unit is valid.

Parameters:

unit (str) –

Return type:

None

split(interval, unit='day')[source]#

Convert a ee.DateRange to a list of ee.DateRange.

The DateRange will be split in multiple DateRanges of the specified interval and Unit. For example “1”, “day”. if the end date is not included the last dateRange length will be adapted.

Parameters:
  • interval (geetools.types.ee_int) – The interval to split the DateRange

  • unit (str) – The unit to split the DateRange. One of: second, minute, hour, day, month, year.

Returns:

The list of DateRanges

Return type:

ee.List

Examples

import ee, geetools

ee.Initialize()

d = ee.DateRange('2020-01-01', '2020-01-31').geetools.split(1, 'day')
d.getInfo()
static unitMillis(unit)[source]#

Get the milliseconds of a unit.

Parameters:

unit (str) –

Return type:

ee.Number