Skip to content

ee.Geometry.Point does not accept varargs after importing eemont #67

@FeiYao-Edinburgh

Description

@FeiYao-Edinburgh

Hi @davemlz !

I just found a VERY weird behavior in eemont 0.2.5. Before importing the eemont, the following code excerpt works perfectly:

import ee
ee.Initialize()

image = ee.ImageCollection("COPERNICUS/S2_SR").first().set("lon",5.9053, "lat",31.6585)

poi = ee.Geometry.Point([image.getNumber("lon"), image.getNumber("lat")]) # A list of two [x,y] coordinates.
print(poi.getInfo())

poi = ee.Geometry.Point(image.getNumber("lon"), image.getNumber("lat")) # varargs.
print(poi.getInfo())

>>>
{'type': 'Point', 'coordinates': [5.9053, 31.6585]}
{'type': 'Point', 'coordinates': [5.9053, 31.6585]}

However, after importing eemont, the last two sentences will prompts the error of "EEException: Invalid argument specified for ee.Number(): <object object at 0x2b9f90c8ed80>":

import eemont

poi = ee.Geometry.Point([image.getNumber("lon"), image.getNumber("lat")]) # A list of two [x,y] coordinates.
print(poi.getInfo())

poi = ee.Geometry.Point(image.getNumber("lon"), image.getNumber("lat")) # varargs.
print(poi.getInfo())

I spent a couple of hours to identify the root of this weird, hard-to-be-spotted issue, so would like to let you and others know about it, although I am not sure if this still exists in the latest version of the eemont. Also not sure if this issue goes to other functions that accept varargs.

All the best,
Fei

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions