Open-EO / openeo-r-client

R client package for working with openEO backends
https://open-eo.github.io/openeo-r-client
Apache License 2.0
61 stars 17 forks source link

compute_result after save_result specifying format produces error #124

Closed przell closed 2 years ago

przell commented 2 years ago

Hi, it seems that with the new release and dev version (1.2.0.900) specifying a format in compute_result after save_result produces an error. See below. Tested on openeo.cloud.

Specifying Format -> Error

result = p$save_result(data = data, format="NetCDF")
compute_result(result,
               format = "NetCDF",
               output_file = out_name, 
               con = con)
Cannot match the value to any of the parameter selection (AnyOf)
HTTP 500 Internal Server Error.
• SERVER-ERROR: Failed to process synchronously on backend vito: OpenEoApiError("[400] ProcessParameterRequired: Process 'n/a' parameter 'data' is required. (ref: 7ad94625-d927-48e5-8dbc-f72e8f64dc2e)")

Not specifying Format -> Works:

result = p$save_result(data = data, format="NetCDF")
compute_result(result,
               #format = "NetCDF",
               output_file = out_name, 
               con = con)

here's the pg for testing (in case you need one):

{
  "process_graph": {
    "load_collection_IVYUZ0175H": {
      "process_id": "load_collection",
      "arguments": {
        "id": "SENTINEL2_L2A",
        "spatial_extent": {
          "west": 6.631536,
          "east": 6.646557,
          "south": 50.811346,
          "north": 50.82171
        },
        "temporal_extent": [
          "2018-01-01",
          "2019-01-01"
        ],
        "bands": [
          "B04",
          "B08"
        ]
      }
    },
    "reduce_dimension_JUPFS9539V": {
      "process_id": "reduce_dimension",
      "arguments": {
        "data": {
          "from_node": "load_collection_IVYUZ0175H"
        },
        "reducer": {
          "process_graph": {
            "array_element_ELQHU2238I": {
              "process_id": "array_element",
              "arguments": {
                "data": {
                  "from_parameter": "data"
                },
                "index": 1,
                "return_nodata": false
              }
            },
            "array_element_OVOVM0926F": {
              "process_id": "array_element",
              "arguments": {
                "data": {
                  "from_parameter": "data"
                },
                "index": 0,
                "return_nodata": false
              }
            },
            "subtract_DRUXE3901J": {
              "process_id": "subtract",
              "arguments": {
                "x": {
                  "from_node": "array_element_ELQHU2238I"
                },
                "y": {
                  "from_node": "array_element_OVOVM0926F"
                }
              }
            },
            "add_GAFDX5275N": {
              "process_id": "add",
              "arguments": {
                "x": {
                  "from_node": "array_element_ELQHU2238I"
                },
                "y": {
                  "from_node": "array_element_OVOVM0926F"
                }
              }
            },
            "divide_UURFM1912R": {
              "process_id": "divide",
              "arguments": {
                "x": {
                  "from_node": "subtract_DRUXE3901J"
                },
                "y": {
                  "from_node": "add_GAFDX5275N"
                }
              },
              "result": true
            }
          }
        },
        "dimension": "bands"
      }
    },
    "aggregate_temporal_DKQSK3037I": {
      "process_id": "aggregate_temporal",
      "arguments": {
        "data": {
          "from_node": "reduce_dimension_JUPFS9539V"
        },
        "intervals": [
          ["2018-01-02", "2018-02-01"],
          ["2018-02-01", "2018-03-01"],
          ["2018-03-01", "2018-04-01"],
          ["2018-04-01", "2018-05-01"],
          ["2018-05-01", "2018-06-01"],
          ["2018-06-01", "2018-07-01"],
          ["2018-07-01", "2018-08-01"],
          ["2018-08-01", "2018-09-01"],
          ["2018-09-01", "2018-10-01"],
          ["2018-10-01", "2018-11-01"],
          ["2018-11-01", "2018-12-01"],
          ["2018-12-01", "2018-12-30"]
        ],
        "reducer": {
          "process_graph": {
            "median_XUSCV4976T": {
              "process_id": "median",
              "arguments": {
                "data": {
                  "from_parameter": "data"
                },
                "ignore_nodata": true
              },
              "result": true
            }
          }
        },
        "labels": [
          "2018-01-02",
          "2018-02-01",
          "2018-03-01",
          "2018-04-01",
          "2018-05-01",
          "2018-06-01",
          "2018-07-01",
          "2018-08-01",
          "2018-09-01",
          "2018-10-01",
          "2018-11-01",
          "2018-12-01"
        ],
        "dimension": "t"
      }
    },
    "save_result_VDXEC1430C": {
      "process_id": "save_result",
      "arguments": {
        "data": {
          "from_node": "aggregate_temporal_DKQSK3037I"
        },
        "format": "NetCDF",
        "options": {}
      },
      "result": true
    }
  },
  "parameters": [],
  "returns": {
    "schema": {
      "type": "boolean"
    }
  }
} 
m-mohr commented 2 years ago

This is related to (parts) of the error message in #123, too.

1.2.0 seems to break peoples workflows when they have save_result and use the format parameter in compute_result. We should fix this and issue a 1.2.1 asap, I think.

m-mohr commented 2 years ago

Discussed in chat:

I would suggest to stop updating the code if save_result already exists and just issue a warning instead. For example: "Warning: The process already contains save_result. The format parameter is ignored in this case."

flahn commented 2 years ago

Usually the save_result process node is created anew if there is parameter format in compute_result specified. There was a problem when passing the prior steps of the old save_result node to the new on.