geetools.Date
#
Extra methods for the ee.Date
class.
Package Contents#
Classes#
Toolbox for the |
Attributes#
- class geetools.Date.DateAccessor(obj)[source]#
Toolbox for the
ee.Date
class.Initialize the Date class.
- Parameters:
obj (ee.Date) –
- static check_unit(unit)[source]#
Check if the provided value is a valid time unit.
- Parameters:
unit (str) –
- Return type:
None
- classmethod fromDOY(doy, year)[source]#
Create a date from a day of year and a year.
- Parameters:
doy (int) – The day of year.
year (int) – The year.
- Returns:
The date as a
ee.Date
object.- Return type:
ee.Date
Examples
import ee, geetools ee.Initialize() d = ee.Date.geetools.fromDOY(1, 2020) d.getInfo()
- classmethod fromEpoch(number, unit='day')[source]#
Set an the number of units since epoch (1970-01-01).
- Parameters:
number (int) – The number of units since the epoch.
unit (str) – The unit to return the number of. One of:
second
,minute
,hour
,day
,month
,year
.
- Returns:
The date as a
ee.Date
object.- Return type:
ee.Date
Examples
import ee, geetools ee.Initialize() d = ee.Date.geetools.fromEpoch(49, 'year') d.getInfo()
- getUnitSinceEpoch(unit='day')[source]#
Get the number of units since epoch (1970-01-01).
- Parameters:
unit (str) – The unit to return the number of. One of:
second
,minute
,hour
,day
,month
,year
.- Returns:
The number of units since the epoch.
- Return type:
ee.Number
Examples
import ee, geetools ee.Initialize() d = ee.Date('2020-01-01').geetools.getUnitSinceEpoch('year') d.getInfo()