Skip to content

using Parameter in load_collection properties #901

@samdoolin

Description

@samdoolin

I am trying to write a UDP that loads the collection SENTINEL1_GRD, parameterised by instrument_mode. (this is minimal example)

...
instrument_mode = Parameter.string(
    name="instrument_mode",
    description="Sentinel 1 instrument mode ['SM', 'IW', 'EW', 'WV']",
    default="IW",
)

s1_grd = connection.load_collection(
    "SENTINEL1_GRD",
    spatial_extent=spatial_extent,
    temporal_extent=temporal_extent,
    properties=[
        openeo.collection_property("sar:instrument_mode") == instrument_mode,
    ],
)

udp_spec = build_process_dict(
    s1_grd,
    parameters=[instrument_mode],
)

with open("UDP.json", "w") as f:
    json.dump(udp_spec, f, indent=2)

udp_args = {"instrument_mode": "IW"}
cube = connection.datacube_from_json("UDP.json", parameters=udp_args)
job = connection.create_job(process_graph=cube)
job.start_and_wait()

but this fails with

Preflight process graph validation raised: [UpstreamValidationInfo] Backend 'cdse' reported validation errors [PropertyConditionInvalid] Unknown parameter instrument_mode
...
openeo.rest.OpenEoApiError: [400] PropertyConditionInvalid: Unknown parameter instrument_mode

The JSON looks ok (as far as I can tell)

{
  "process_graph": {
    "loadcollection1": {
      "process_id": "load_collection",
      "arguments": {
        "id": "SENTINEL1_GRD",
        "properties": {
          "sar:instrument_mode": {
            "process_graph": {
              "eq1": {
                "process_id": "eq",
                "arguments": {
                  "x": {
                    "from_parameter": "value"
                  },
                  "y": {
                    "from_parameter": "instrument_mode"
                  }
                },
                "result": true
              }
            }
          }
        },
        "spatial_extent": {
          "west": 30.944,
          "south": 1.273,
          "east": 30.948,
          "north": 1.277
        },
        "temporal_extent": [
          "2020-01-01",
          "2020-04-01"
        ]
      },
      "result": true
    }
  },
  "parameters": [
    {
      "name": "instrument_mode",
      "description": "Sentinel 1 instrument mode ['SM', 'IW', 'EW', 'WV']",
      "schema": {
        "type": "string"
      },
      "default": "IW",
      "optional": true
    }
  ]
}

Is there something afoot with the scoping of the nested process_graph?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions