Open-EO / openeo-pg-parser-python

A python parser for openEO process graphs
Apache License 2.0
1 stars 6 forks source link

Is "from_argument" : "value" supported? #5

Closed lforesta closed 4 years ago

lforesta commented 4 years ago

The following is copy-pasted from an email from @kempenep

I tried to extend the the process_id "load_collection" with some "properties", similar to the example in https://open-eo.github.io/openeo-api/processreference/#load_collection

It seems I get an raise Exception('"from_argument" reference is wrong.') from the translate_process_graph:

Could it be the code is not ready for a "from_argument" : "value"

Thanks, Pieter.

This is the part of the graph for load_collection:

  "loadcollection1": {
      "process_id": "load_collection",
      "arguments": {
          "id": "S2MSI1C",
          "spatial_extent": {
              "west": 11.279182434082033,
              "east": 11.406898498535158,
              "north": 46.522729291844286,
              "south": 46.464349400461145,
              "crs": "EPSG:4326"
          },
          "temporal_extent": [
              "2018-06-04T00:00:00.000Z",
              "2018-06-23T00:00:00.000Z"
          ],
          "properties": {
              "eo:cloud_cover": {
                  "callback": {
                      "cc": {
                          "process_id": "between",
                          "arguments": {
                              "x": {
                                  "from_argument": "value"
                              },
                              "min": 0,
                              "max": 10
                          }
                      }
                  }
              }
          }
      },
      "result": false
  },
lforesta commented 4 years ago

@claxn does the python parser also cope with the "from_argument" : "value" syntax? I never tried this yet

m-mohr commented 4 years ago

In general, the properties parameter in load_collection is broken and we need a better solution for the next version. Also, the process graph above is invalid. The key "eo:cloud_cover" is not supported at that place.

On the other hand, from_argument should be supported.

lforesta commented 4 years ago

Actually the parser correctly supports "from_argument". Checking this again, I think the problem here is that "value" is not defined anywhere. For example, in this snippet, "data" is defined before being used with "from_argument":

,
  "reduce1": {
    "process_id": "reduce",
    "arguments": {
      "data": {
        "from_node": "loadcollection1"
      },
      "dimension": "spectral_bands",
      "reducer": {
        "callback": {
          "arrayelement1": {
            "process_id": "array_element",
            "arguments": {
              "data": {
                "from_argument": "data"
              },
              "index": 7
            },
            "result": false
          },

I think the example from @kempenep reflects the example in load_collection. @m-mohr What is "value" supposed to be in that example?

m-mohr commented 4 years ago

In general, parameters for callbacks are defined in the specification of the process. In the properties case in load_collection: It is broken as I said. It will not work at the moment, the behaviour is not well defined.