'Import a JavaScript file in Python and run several functions
I have been trying to use earthengine-api (Google Earth Engine) in Python (specifically in Jupyter Notebook). When I import a JavaScript file using js2py library, like below:
import js2py
functions_js = js2py.run_file('several_functions.js')
I get the following output:
print(functions_js):
({'Year': 'function (x, n) { [python code] }',
'addData': 'function addData(img, pheno) { [python code] }',
... ,
'aggregate': 'function (image, prop, reducerList, bandsList, delta) { [python code] }'
...
<js2py.evaljs.EvalJs object at 0x000001C7680AB3D0>)
I have tried to use those functions, like below:
functions_js.aggregate(image, "date_daily", 'sum')
However, it is not working.
JsException: ReferenceError: ee is not defined
How can I do this correctly?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
