HamedElgizery / grass-addons

GRASS GIS Addons Repository (Manuals: https://grass.osgeo.org/grass-stable/manuals/addons/ | Linux-logs: https://grass.osgeo.org/addons/grass8/logs/ | Windows logs: https://wingrass.fsv.cvut.cz/grass83/addons/grass-8.3.1/logs/)
GNU General Public License v2.0
0 stars 3 forks source link

[Bug] without map option return an error #14

Closed lucadelu closed 2 months ago

lucadelu commented 2 months ago

Name of the addon i.eodag

Describe the bug If map option is not set it return the following error

python i.eodag.py -l start=2022-05-25 end=2022-06-01 dataset=S2_MSI_L2A clouds=50
WARNING: Experimental Version...
WARNING: This module is still under development, and its behaviour is not
         guaranteed to be reliable
Traceback (most recent call last):
  File "shapely/speedups/_speedups.pyx", line 252, in shapely.speedups._speedups.geos_linearring_from_py
AttributeError: 'tuple' object has no attribute '__array_interface__'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/lucadelu/github/grass-addons/src/imagery/i.eodag/i.eodag.py", line 507, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/lucadelu/github/grass-addons/src/imagery/i.eodag/i.eodag.py", line 464, in main
    search_result = dag.search_all(**search_parameters)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/eodag/api/core.py", line 1337, in search_all
    search_plugins, search_kwargs = self._prepare_search(
                                    ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/eodag/api/core.py", line 1555, in _prepare_search
    kwargs["geometry"] = get_geometry_from_various(self.locations_config, **kwargs)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/eodag/utils/__init__.py", line 1088, in get_geometry_from_various
    geom = Polygon(
           ^^^^^^^^
  File "/usr/lib/python3/dist-packages/shapely/geometry/polygon.py", line 261, in __init__
    ret = geos_polygon_from_py(shell, holes)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/shapely/geometry/polygon.py", line 539, in geos_polygon_from_py
    ret = geos_linearring_from_py(shell)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "shapely/speedups/_speedups.pyx", line 373, in shapely.speedups._speedups.geos_linearring_from_py
TypeError: must be real number, not str

To Reproduce to reproduce run

python i.eodag.py -l start=2022-05-25 end=2022-06-01 dataset=S2_MSI_L2A clouds=50

Expected behavior I think it should use the computation region as AOI

HamedElgizery commented 2 months ago

Can you please send the result of running the same command with --verbose

It is running on my side and I can't reproduce it... Are you using NC mapset or another one?

HamedElgizery commented 2 months ago

I have just came across the bug, and I fixed it. I will push the fix here https://github.com/OSGeo/grass-addons/pull/1136

It is in this code snippet:

    gs.verbose("Generating AOI from bounding box...")
    if proj["+proj"] != "longlat":
        info = gs.parse_command("g.region", flags="uplg")
        return {
            "lonmin": info["nw_long"],
            "latmin": info["sw_lat"],
            "lonmax": info["ne_long"],
            "latmax": info["nw_lat"],
        }

It should be:

    gs.verbose("Generating AOI from bounding box...")
    if proj["+proj"] != "longlat":
        info = gs.parse_command("g.region", flags="uplg")
        return {
            "lonmin": float(info["nw_long"]),
            "latmin": float(info["sw_lat"]),
            "lonmax": float(info["ne_long"]),
            "latmax": float(info["nw_lat"]),
        }
HamedElgizery commented 2 months ago

Should be fixed. Closing.