davemlz / eemont

A python package that extends Google Earth Engine.
https://eemont.readthedocs.io/
MIT License
417 stars 69 forks source link

some methods and modules do not work #78

Closed navidboy70 closed 2 years ago

navidboy70 commented 2 years ago

Describe the bug I am trying to use geemap,eemont and ee to derive some indices from sentinel-2 dataset from GEE python API in VSCode. the problem is that some methods and modules can not be recognized by python and I face error. I also copied the exact scripts from your tutorials, but the problem still exists.

To Reproduce import ee, eemont, geemap

   S2 = (ee.ImageCollection("COPERNICUS/S2_SR")
            .filterBounds(ROI)
            .filterDate("2020-01-01","2021-01-01")
            .preprocess()
            .maskClouds()
            .scaleAndOffset()
            )
    S2online = S2.spectralIndices(["NDVI","kNDVI","NDWI","SeLI"],online = True).median()

AttributeError: 'ImageCollection' object has no attribute 'preprocess'

Screenshots If applicable, add screenshots to help explain your problem.

Setup (please complete the following information):

Additional context Add any other context about the problem here.

davemlz commented 2 years ago

Hi @navidboy70!

I tried the code that you sent (with another ROI since I don't have access to the one you're using) and everything works fine in VS Code, JN, and Colab. Please try the following:

  1. The preprocess method was created for eemont>=0.2.0. Check you are actually using eemont with a version greater or equal to 0.2.0. You can check the version with eemont.__version__. You can update eemont with pip install -U eemont.
  2. The preprocess method is actually a short method for object.maskClouds().scaleAndOffset(): You shouldn't use these methods after calling preprocess.

If the problem persists, please paste here the complete code with a screenshot of the error.

Best,

David

navidboy70 commented 2 years ago

Hi David, I managed to fix the problem. Thank you very much. Unfortunately, I have faced another problem with your library in the google earth engine code editor. I write your spectral code : 'var spectral = require("users/dmlmont/spectral:spectral");', but it causes an error : 'In users/dmlmont/spectral:spectral-constants Line 51: None is not defined'

I did not have problem with it since 2 days ago, but now it does not work. I will be really thankful, if you response it. best regards, Navid

On Wed, Sep 14, 2022 at 7:49 PM David Montero Loaiza < @.***> wrote:

Hi @navidboy70 https://github.com/navidboy70!

I tried the code that you sent (with another ROI since I don't have access to the one you're using) and everything works fine in VS Code, JN, and Colab. Please try the following:

  1. The preprocess method was created for eemont>=0.2.0. Check you are actually using eemont with a version greater or equal to 0.2.0. You can check the version with eemont.version. You can update eemont with pip install -U eemont.
  2. The preprocess method is actually a short method for object.maskClouds().scaleAndOffset(): You shouldn't use these methods after calling preprocess.

If the problem persists, please paste here the complete code with a screenshot of the error.

Best,

David

— Reply to this email directly, view it on GitHub https://github.com/davemlz/eemont/issues/78#issuecomment-1246927968, or unsubscribe https://github.com/notifications/unsubscribe-auth/A2DIWAMFWSQ4EQUU75DAZETV6HUILANCNFSM6AAAAAAQI4GGVM . You are receiving this because you were mentioned.Message ID: @.***>

davemlz commented 2 years ago

Sorry, it was an error when translating from Python to JavaScript. It has been fixed! :)

Bets regards,

David

navidboy70 commented 2 years ago

thank you David.

On Sun, Oct 9, 2022 at 3:45 PM David Montero Loaiza < @.***> wrote:

Closed #78 https://github.com/davemlz/eemont/issues/78 as completed.

— Reply to this email directly, view it on GitHub https://github.com/davemlz/eemont/issues/78#event-7549325933, or unsubscribe https://github.com/notifications/unsubscribe-auth/A2DIWAN2ZWJ7DWHOCUUBNTTWCKZOLANCNFSM6AAAAAAQI4GGVM . You are receiving this because you were mentioned.Message ID: @.***>

navidboy70 commented 2 years ago

Hello David, I am using your library 'eemont' in python environment (VSCode), when I use '.preprocess()' method in my code it faces an error 'ee.ee_exception.EEException: Request payload size exceeds the limit: 10485760 bytes.' . However, without it, it prints the output. ' S2_1 = ( eemont.ee.ImageCollection(dataset) .filterBounds(state) .filterDate('2021-09-23','2021-10-23') .preprocess())

' KeyboardInterrupt ^C (venv) D:\python_projects\GEE_classification>d:/python_projects/GEE_classification/venv/Scripts/python.exe d:/python_projects/GEE_classification/classification.py Traceback (most recent call last): File "d:\python_projects\GEE_classification\venv\lib\site-packages\ee\data.py", line 328, in _execute_cloud_call return call.execute(num_retries=num_retries) File "d:\python_projects\GEE_classification\venv\lib\site-packages\googleapiclient_helpers.py", line 134, in positional_wrapper return wrapped(*args, **kwargs) File "d:\python_projects\GEE_classification\venv\lib\site-packages\googleapiclient\http.py", line 915, in execute raise HttpError(resp, content, uri=self.uri) googleapiclient.errors.HttpError: <HttpError 400 when requesting https://earthengine.googleapis.com/v1alpha/projects/earthengine-legacy/value:compute?prettyPrint=false&alt=json returned "Request payload size exceeds the limit: 10485760 bytes.". Details: "Request payload size exceeds the limit: 10485760 bytes.">

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "d:/python_projects/GEE_classification/classification.py", line 73, in S2_1 = ( eemont.ee.ImageCollection(dataset) File "d:\python_projects\GEE_classification\venv\lib\site-packages\eemont\imagecollection.py", line 936, in preprocess return ee_extra.QA.pipelines.preprocess(self, kwargs) File "d:\python_projects\GEE_classification\venv\lib\site-packages\ee_extra\QA\pipelines.py", line 37, in preprocess x = maskClouds(x, kwargs) File "d:\python_projects\GEE_classification\venv\lib\site-packages\ee_extra\QA\clouds.py", line 325, in maskClouds platformDict = _get_platform_STAC(x) File "d:\python_projects\GEE_classification\venv\lib\site-packages\ee_extra\STAC\utils.py", line 25, in _get_platform_STAC ID = args.get("system:id").getInfo() File "d:\python_projects\GEE_classification\venv\lib\site-packages\ee\computedobject.py", line 98, in getInfo return data.computeValue(self) File "d:\python_projects\GEE_classification\venv\lib\site-packages\ee\data.py", line 757, in computeValue return _execute_cloud_call( File "d:\python_projects\GEE_classification\venv\lib\site-packages\ee\data.py", line 330, in _execute_cloud_call raise _translate_cloud_exception(e) ee.ee_exception.EEException: Request payload size exceeds the limit: 10485760 bytes.

On Sun, Oct 9, 2022 at 3:56 PM Navid Zed @.***> wrote:

thank you David.

On Sun, Oct 9, 2022 at 3:45 PM David Montero Loaiza < @.***> wrote:

Closed #78 https://github.com/davemlz/eemont/issues/78 as completed.

— Reply to this email directly, view it on GitHub https://github.com/davemlz/eemont/issues/78#event-7549325933, or unsubscribe https://github.com/notifications/unsubscribe-auth/A2DIWAN2ZWJ7DWHOCUUBNTTWCKZOLANCNFSM6AAAAAAQI4GGVM . You are receiving this because you were mentioned.Message ID: @.***>