eedate_to_rdate: Pass an Earth Engine date object to R

Description Usage Arguments Details Value Examples

View source: R/ee_Date.R

Description

Pass an Earth Engine date object to R

Usage

1

Arguments

ee_date

EE date object (ee$Date)

timestamp

Logical. If TRUE, return the date in milliseconds from the Unix Epoch (1970-01-01 00:00:00 UTC) otherwise return the date as a POSIXct object. By default FALSE.

Details

eedate_to_rdate is essential to avoid potential errors which could appear when users call to retrieve the date. Currently, R integer only support 32 bit signed, such integers can only count up to about 2 billion. This range is extremely insufficient to deal with Google Earth Engine date, which is represent by timestamp in milliseconds since the UNIX epoch. eedate_to_rdate use Python as a backend to obtain the date and convert it in float before to export to R.

Value

eedate_to_rdate will return a numeric timestamp or an POSIXct object depending on the timestamp argument.

Examples

1
2
3
4
5
6
library(rgee)
ee_reattach()
ee_Initialize()
eeDate <- ee$Date$fromYMD(2010,1,1)
eedate_to_rdate(eeDate,timestamp = TRUE) # good
eeDate$getInfo()$value # bad

ryali93/rgee documentation built on May 13, 2020, 4:34 a.m.