r-spatial / rgee

Google Earth Engine for R
https://r-spatial.github.io/rgee/
Other
677 stars 146 forks source link

$filterDate not working on S1 and S2 data, works on landsat #304

Closed raruggie closed 1 year ago

raruggie commented 1 year ago

At submit an issue, please attached the following information of your rgee session:

library(rgee)

# Initialize the Earth Engine module.
ee_Initialize()

# Print metadata for a DEM dataset.
print(ee$Image('USGS/SRTMGL1_003')$getInfo())

Yes, this gives a big output, the first few lines are:

$type
[1] "Image"

$bands
$bands[[1]]
$bands[[1]]$id
[1] "elevation"

$bands[[1]]$data_type
$bands[[1]]$data_type$type

Attach your Python (reticulate) configuration:

library(reticulate)
py_config()
python:         C:/Users/ryrug/anaconda3/envs/rgee/python.exe
libpython:      C:/Users/ryrug/anaconda3/envs/rgee/python38.dll
pythonhome:     C:/Users/ryrug/anaconda3/envs/rgee
version:        3.8.13 | packaged by conda-forge | (default, Mar 25 2022, 05:59:00) [MSC v.1929 64 bit (AMD64)]
Architecture:   64bit
numpy:          C:/Users/ryrug/anaconda3/envs/rgee/Lib/site-packages/numpy
numpy_version:  1.23.4
ee:             C:\Users\ryrug\ANACON~1\envs\rgee\lib\site-packages\ee\__init__.p

NOTE: Python version was forced by RETICULATE_PYTHON

Description

Describe what you were trying to get done. Tell us what happened, what went wrong, and what you expected to happen.

I am following an rgee tutorial: https://www.css.cornell.edu/faculty/dgr2/_static/files/R_html/ex_rgee.html

under 3 Example: Imagery, the code gives:

dataset <- ee$ImageCollection('LANDSAT/LC08/C01/T1_8DAY_EVI')$filterDate('2017-01-01', '2017-12-31')
ee_print(dataset)

Which works on my machine, i.e. the filter reduces the number of images to 46, number shown in the tutorial. However, I am working with Sentinel data, so I changed the above code to:

dataset <- ee$ImageCollection('COPERNICUS/S1_GRD')$filterDate('2017-01-01', '2017-12-31')
ee_print(dataset)

This runs on my machine, but when I look at the output, the Image collection was not filtered, it contains over 36000 images:

ImageCollection Metadata:
 - Class                      : ee$ImageCollection
 - Number of Images           : 360662
 - Number of Properties       : 2
 - Number of Pixels*          : 3.724005e+14
 - Approximate size*          : 2.09 PB

Something is going on with the mix of Sentinel data and $filterDate since the filter works on Landsat

I should also say that the same happens with S2:

dataset <- ee$ImageCollection('COPERNICUS/S2_SR')$filterDate('2017-01-01', '2017-12-31')
ee_print(dataset)

output:

ImageCollection Metadata:
 - Class                      : ee$ImageCollection
 - Number of Images           : 112336
 - Number of Properties       : 23
 - Number of Pixels*          : 8.657375e+12
 - Approximate size*          : 3.21 PB