library(rgee)
# Initialize the Earth Engine module.
ee_Initialize()
# Print metadata for a DEM dataset.
print(ee$Image('USGS/SRTMGL1_003')$getInfo())
Attach your Python (reticulate) configuration:
python: /home/victor/.local/share/r-miniconda/envs/r-reticulate/bin/python3
libpython: /home/victor/.local/share/r-miniconda/envs/r-reticulate/lib/libpython3.6m.so
pythonhome: /home/victor/.local/share/r-miniconda/envs/r-reticulate:/home/victor/.local/share/r-miniconda/envs/r-reticulate
version: 3.6.13 | packaged by conda-forge | (default, Feb 19 2021, 05:36:01) [GCC 9.3.0]
numpy: /home/victor/.local/share/r-miniconda/envs/r-reticulate/lib/python3.6/site-packages/numpy
numpy_version: 1.19.5
NOTE: Python version was forced by use_python function
I first load Sentinel 1 imagery and filter according to my study area,time,VV/VH polarization and ascending or descending path.THe code to do these procedure is as follows
library(rgee)
library(tcltk)
#Load sentinel1 image collection
sentinel1 <-ee$ImageCollection('COPERNICUS/S1_GRD')
#AOI Geometry
Ext <- list(
c(35.953444081338944, 0.31636293022018336),
c(36.21024950126082,0.31636293022018336),
c(36.21024950126082, 0.7475567060026045),
c(35.953444081338944, 0.7475567060026045))
marigat_plains <- ee$Geometry$Polygon(coords = Ext, proj = "EPSG:4326",
geodesic = FALSE)
#user dateinput
start <- ee$Date('2014-01-01')
end <- ee$Date('2014-12-31')
#Filter to get images with VV and VH polarization,specified date and region
vv <- sentinel1$filter(ee$Filter$listContains('transmitterReceiverPolarisation',
'VV'))
vh <- vv$filter(ee$Filter$listContains('transmitterReceiverPolarisation', 'VH'))
iws <- vh$filter(ee$Filter$eq('instrumentMode', 'IW'))
filtered <- iws$filterBounds(marigat_plains)$filterDate(start, end)
filtered$getInfo()
#select path,ASCENDING or DESCENDING
path <-'ASCENDING'
if (path == 'ASCENDING') {
selectedPath <- filtered$filter(ee$Filter$eq('orbitProperties_pass',
'ASCENDING'))
} else if(path == 'DESCENDING') {
selectedPath <- filtered$filter(ee$Filter$eq('orbitProperties_pass',
'ASCENDING'))
} else {
print("Specifiy whether ASCENDING/DESCENDING")
}
After applying the filters,I define a function to fetch data from CFSV2: NCEP Climate Forecast System Version 2, 6-Hourly Products for the purpose of wind masking in order to eliminate surface roughening by wind.This function takes a date in the format YY-MM-DD as a parameter and returns an ee-image.
ncep <- function(date){
#rdate <-eedate_to_rdate(eeDate,timestamp = TRUE)
wx <- ee$ImageCollection('NOAA/CFSV2/FOR6H')$filterDate(date)
vwind <- wx$select('v-component_of_wind_height_above_ground')
a <- vwind$max()
uwind <- wx$select('u-component_of_wind_height_above_ground')
b <- uwind$max()
a <- a$pow(2)
b <- b$pow(2)
ab <- a$add(b)
ws <- ab$sqrt()
ws <- ws$multiply(3.6)
return (ws$rename('windy')$set('date',date))
}
In order to get data for every scene in my image collection I did a funtion to format the dates to the format yy-mm-dd and aggregate them into an eelist as follows,
#Get the dates from the image and format them
dates <- selectedPath$map(function(image) {
return(image$set('date', image$date()$format('Y-MM-dd')))
})
#Get a list of dates
datelist <- dates$aggregate_array('date')
I then try to map the list of dates to the function ncep as follows
ws <- ee$List(datelist)$map(ncep)
I get the error
Error in py_call_impl(callable, dots$args, dots$keywords) :
RuntimeError: Evaluation error: argument "date" is missing, with no default.
Detailed traceback:
File "/home/victor/.virtualenvs/rgee/lib/python3.6/site-packages/ee/apifunction.py", line 205, in <lambda>
return lambda *args, **kwargs: func.call(*args, **kwargs) # pylint: disable=unnecessary-lambda
File "/home/victor/.virtualenvs/rgee/lib/python3.6/site-packages/ee/function.py", line 67, in call
return self.apply(self.nameArgs(args, kwargs))
File "/home/victor/.virtualenvs/rgee/lib/python3.6/site-packages/ee/function.py", line 80, in apply
result = computedobject.ComputedObject(self, self.promoteArgs(named_args))
File "/home/victor/.virtualenvs/rgee/lib/python3.6/site-packages/ee/function.py", line 107, in promoteArgs
promoted_args[name] = Function._promoter(args[name], spec['type'])
File "/home/victor/.virtualenvs/rgee/lib/python3.6/site-packages/ee/__init__.py", line 245, in _Promote
return CustomFunction.create(arg, 'Object', ['Object'] * args
At submit an issue, please attached the following information of your
rgee
session:[1] You have the Python API installed (from terminal):
[1] You can find the credentials file on your system:
[1] You can run a simple EE command from R:
Attach your Python (reticulate) configuration:
I first load Sentinel 1 imagery and filter according to my study area,time,VV/VH polarization and ascending or descending path.THe code to do these procedure is as follows
After applying the filters,I define a function to fetch data from CFSV2: NCEP Climate Forecast System Version 2, 6-Hourly Products for the purpose of wind masking in order to eliminate surface roughening by wind.This function takes a date in the format YY-MM-DD as a parameter and returns an ee-image.
In order to get data for every scene in my image collection I did a funtion to format the dates to the format yy-mm-dd and aggregate them into an eelist as follows,
I then try to map the list of dates to the function ncep as follows
I get the error