Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

load collection: temporal extent with two reference nodes returns an error #13

Closed
JeroenVerstraelen opened this issue May 14, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@JeroenVerstraelen
Copy link

The web editor currently does not support a process graph where the temporal extent of a load_collection consists of two reference nodes:

[
  {
    "from_node": "dateshift1"
  },
  {
    "from_node": "textconcat2"
  }
]

This results in the following error:

Incoming data type is not compatible for parameter "temporal_extent"

Full process graph:

{
  "id": "temp",
  "parameters": [
    {
      "default": "2024",
      "description": "The year for wind turbine detection.",
      "name": "year",
      "optional": true,
      "schema": {
        "type": "string"
      }
    },
    {
      "description": "A bounding box with the required fields `west`, `south`, `east`, `north` and optionally `base`, `height`, `crs`. The `crs` is a EPSG code or a WKT2:2018 string.",
      "name": "bbox",
      "schema": {
        "subtype": "bounding-box",
        "type": "object"
      }
    }
  ],
  "process_graph": {
    "dateshift1": {
      "arguments": {
        "date": {
          "from_node": "textconcat1"
        },
        "unit": "year",
        "value": -1
      },
      "process_id": "date_shift"
    },
    "loadcollection1": {
      "arguments": {
        "bands": [
          "B04",
          "B03",
          "B02",
          "SCL"
        ],
        "id": "TERRASCOPE_S2_TOC_V2",
        "properties": {
          "eo:cloud_cover": {
            "process_graph": {
              "lte1": {
                "arguments": {
                  "x": {
                    "from_parameter": "value"
                  },
                  "y": 20
                },
                "process_id": "lte",
                "result": true
              }
            }
          }
        },
        "spatial_extent": {
          "from_parameter": "bbox"
        },
        "temporal_extent": [
          {
            "from_node": "dateshift1"
          },
          {
            "from_node": "textconcat2"
          }
        ]
      },
      "process_id": "load_collection",
      "result": true
    },
    "textconcat1": {
      "arguments": {
        "data": [
          {
            "from_parameter": "year"
          },
          "10-01"
        ],
        "separator": "-"
      },
      "process_id": "text_concat"
    },
    "textconcat2": {
      "arguments": {
        "data": [
          {
            "from_parameter": "year"
          },
          "04-01"
        ],
        "separator": "-"
      },
      "process_id": "text_concat"
    }
  }
}

Python code that created the UDP:

from openeo.api.process import Parameter
from openeo.processes import text_concat, date_shift
import openeo

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

year = Parameter.string(
    name="year",
    description="The year for wind turbine detection.",
    default="2024"
)

bbox = Parameter(
    name="bbox",
    description="A bounding box with the required fields `west`, `south`, `east`, `north` and optionally `base`, `height`, `crs`. The `crs` is a EPSG code or a WKT2:2018 string.",
    schema={
        'type':'object',
        'subtype':'bounding-box'
    }
)

# Define temporal extent
startdate = text_concat([year, "10-01"], separator="-")
startdate = date_shift(startdate, -1, "year")
enddate = text_concat([year, "04-01"], separator="-")

# Load collection with specified temporal and spatial extent
cube = c.load_collection(
    "TERRASCOPE_S2_TOC_V2",
    temporal_extent=[startdate, enddate],
    spatial_extent=bbox,
    bands=["B04", "B03", "B02", "SCL"],
    max_cloud_cover=20,
)

process_id = "temp"
udp_result = c.save_user_defined_process(
    user_defined_process_id=process_id,
    process_graph=cube,
    parameters=[year, bbox],
)
@m-mohr
Copy link
Member

m-mohr commented May 25, 2024

The text_concat returns a string, not a string with subtype date-time. I assume that is the issue.

The actual issue has to be fixed in openeo-vue-components, so transferred the issue.
It might also be that this needs an update in openeo-js-processgraphs, in JsonSchemaValidator.isSchemaCompatible.

This is related to Open-EO/openeo-processes#504 which would give a way to cast to the correct types.

@m-mohr m-mohr transferred this issue from Open-EO/openeo-web-editor May 25, 2024
@m-mohr m-mohr added the bug Something isn't working label May 25, 2024
@m-mohr m-mohr transferred this issue from Open-EO/openeo-vue-components Aug 12, 2024
@m-mohr
Copy link
Member

m-mohr commented Aug 12, 2024

Should be fixed in the next version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants