[GIS] “Undefined variable from import” Earth Engine and Python API

google-earth-engineimportpython

I'm writing some code for a GEE Application and I want to calculate the area of pixels in a given area.
I've found this method:


areas = (imNDVI4.multiply(ee.Image.pixelArea()).reduceRegion(reducer = ee.Reducer.sum(), geometry = test2, scale=10))

Unfortunately, I'm unable to run this part because of this error:

Undefined variable from import: …

that pops up both on pixelArea() and Reducer methods.

How could I solve this issue?


P.S. My "earthengine-api" package is already up to date.

Best Answer

I personally solved this issue after an aid from a friend of mine. The problem is not due to Python itself but by its interpreter.

So, if you're using Eclipse follow this procedure: Window > Preferences > PyDev > Editor > Code Analysis > Undefined > Undefined variable from import > Ignore

This is also quite useful if you want to not show those boring warnings from unused imports. The procedure is just the same, only change the selected tab.