Quantiles with apply_dimension

I’m trying to generate a sample result using the quantiles process inside apply_dimension.

Am I missing something @jeroen.dries? It seems that the process does not create a new dimension if required but puts anyway the result in the t dimension.

Sample process graph:

{
  "process_graph": {
    "load1": {
      "process_id": "load_collection",
      "arguments": {
        "bands": [
          "B04"
        ],
        "id": "SENTINEL2_L2A",
        "spatial_extent": {
          "east": 11.43389977728051,
          "north": 46.53229652592112,
          "south": 46.52941908750711,
          "west": 11.43021520978765
        },
        "temporal_extent": [
          "2021-03-01T00:00:00Z",
          "2021-11-30T00:00:00Z"
        ]
      }
    },
    "save1": {
      "process_id": "save_result",
      "arguments": {
        "data": {
          "from_node": "apply1"
        },
        "format": "NETCDF"
      },
      "result": true
    },
    "apply1": {
      "process_id": "apply_dimension",
      "arguments": {
        "data": {
          "from_node": "load1"
        },
        "process": {
          "process_graph": {
            "quantiles1": {
              "process_id": "quantiles",
              "arguments": {
                "data": {
                  "from_parameter": "data"
                },
                "probabilities": [],
                "q": 10
              },
              "result": true
            }
          }
        },
        "dimension": "t",
        "target_dimension": "q"
      }
    }
  },
  "parameters": []
}

In what way do you see that? in the resulting geotiff or netcdf?

Can you try setting ‘target_dimension’ to ‘bands’ ?

So, this is the result I’m getting not setting the target_dimension or setting it to q:

<xarray.Dataset>
Dimensions:  (t: 9, x: 30, y: 34)
Coordinates:
  * t        (t) datetime64[ns] 2021-03-02 2021-03-07 ... 2021-03-22 2021-03-24
  * x        (x) float64 6.864e+05 6.864e+05 6.864e+05 ... 6.866e+05 6.867e+05
  * y        (y) float64 5.156e+06 5.156e+06 5.156e+06 ... 5.156e+06 5.156e+06
Data variables:
    B04      (t, y, x) float32 ...
Attributes:
    Conventions:  CF-1.8
    institution:  openEO platform

and this when setting target_dimension to bands, which is even worse since I get a single values instead of 10!

<xarray.Dataset>
Dimensions:  (x: 30, y: 34)
Coordinates:
  * x        (x) float64 6.864e+05 6.864e+05 6.864e+05 ... 6.866e+05 6.867e+05
  * y        (y) float64 5.156e+06 5.156e+06 5.156e+06 ... 5.156e+06 5.156e+06
Data variables:
    B04      (y, x) float32 ...
Attributes:
    Conventions:  CF-1.8
    institution:  openEO platform

by the way, the first result is also partially wrong, the dimension labels should be integers and not temporal strings:
The dimension labels are preserved when the target dimension is the source dimension and the number of pixel values in the source dimension is equal to the number of values computed by the process. Otherwise, the dimension labels will be incrementing integers starting from zero, which can be changed using rename_labels afterwards. The number of labels will equal to the number of values computed by the process. source: openEO API Processes

@stefaan.lippens @jeroen.dries did you manage to solve this?

I actually wanted to reply to this recent question about statistics from an user here, which is more or less related, and while looking for related questions and I found this one from myself

Hi Michele,
I have little time to do some testing myself right now, but my guess would be to use rename_labels, to fix the dimension labels of the ‘bands’ dimension after computing quantiles.
It now still seems to be set to B04, and I have the impression that our netcdf exporter derives from this that you have only one band.