Open-EO / openeo-python-client

Python client API for OpenEO
https://open-eo.github.io/openeo-python-client/
Apache License 2.0
156 stars 42 forks source link

apply_neighborhood causes crash when overlap parameter is left undefined #519

Closed GriffinBabe closed 11 months ago

GriffinBabe commented 11 months ago

When using the apply_neighborhood function and leaving the overlap parameter undefined (which is set to None by default), the geotrellis driver returns a 500 code on the request.

OpenEoApiError: [500] Internal: Server error: TypeError("'NoneType' object is not iterable")

Maybe the overlap parameter should be set by default to overlap=[] instead of overlap=None?

Minimal example:

import openeo

spatial_context = {
    "west": 5.0515130512706845,
    "south": 51.215806593713,
    "east": 5.060320484557499,
    "north": 51.22149744530769,
    "crs": "EPSG:4326"
}

temporal_context = ["2023-01-01", "2023-02-28"]

connection = openeo.connect("https://openeo.vito.be").authenticate_oidc()

cube = connection.load_collection(
    collection_id="SENTINEL2_L2A",
    spatial_extent=spatial_context,
    temporal_extent=temporal_context,
    bands=["SCL"]
)

def dummy_function(cube):
    return cube + 1

cube = cube.apply_neighborhood(
    dummy_function,
    size=[
        {"dimension": "x", "unit": "px", "value": 1},
        {"dimension": "y", "unit": "px", "value": 1}
    ],
)

cube.download('output.nc', format="NetCDF")
jdries commented 11 months ago

fix committed