Hi,
Thanks @nicola.ciapponi for the explanation of the use case. Thanks @stefaan.lippens for digging into this!
Here are two tests I have conducted, more on the technical side.
Question: How to use the result of aggregate_spatial as a threshold in the following processes?
Example: Directly use the result of aggregate_spatial
and connect it to the context of apply
with a callback gt
that will be used for masking.
Process Graph:
{
"process_graph": {
"aggregate2": {
"arguments": {
"data": {
"from_node": "load1"
},
"geometries": {
"coordinates": [
[
[
11.887589773041645,
46.429362477197685
],
[
11.837292446283431,
46.429362477197685
],
[
11.837292446283431,
46.449001496027336
],
[
11.887589773041645,
46.449001496027336
],
[
11.887589773041645,
46.429362477197685
]
]
],
"type": "Polygon"
},
"reducer": {
"process_graph": {
"mean1": {
"arguments": {
"data": {
"from_parameter": "data"
}
},
"process_id": "mean",
"result": true
}
}
}
},
"process_id": "aggregate_spatial"
},
"apply6": {
"arguments": {
"context": {
"from_node": "aggregate2"
},
"data": {
"from_node": "load1"
},
"process": {
"process_graph": {
"gt2": {
"arguments": {
"x": {
"from_parameter": "x"
},
"y": {
"from_parameter": "context"
}
},
"process_id": "gt",
"result": true
}
}
}
},
"process_id": "apply"
},
"load1": {
"arguments": {
"bands": [
"B01"
],
"id": "SENTINEL2_L2A",
"spatial_extent": {
"east": 11.907770486313042,
"north": 46.46882281034837,
"south": 46.422061000608664,
"west": 11.817009058680437
},
"temporal_extent": [
"2016-12-01T00:00:00Z",
"2016-12-10T00:00:00Z"
]
},
"process_id": "load_collection"
},
"mask7": {
"arguments": {
"data": {
"from_node": "load1"
},
"mask": {
"from_node": "apply6"
}
},
"process_id": "mask"
},
"save8": {
"arguments": {
"data": {
"from_node": "mask7"
},
"format": "GTIFF"
},
"process_id": "save_result",
"result": true
}
}
}
ID: j-2403181c3b004908a799c68699c942c9
Error:
OpenEO batch job failed: AttributeError("'AggregateSpatialResultCSV' object has no attribute '_get_object_id'")
+46s 430msERROR
ID: [1710756252951, 707133]
I have also tried to pipe the result of aggregate_spatial
into array_create
+first
. ID:j-240318d6291347088a04cfe9a290aae4
Error:
OpenEO batch job failed: ProcessParameterInvalidException(status_code=400, code='ProcessParameterInvalid', message="The value passed for parameter 'data' in process 'array_create' is invalid: Expected <class 'list'> but got <class 'openeo_driver.save_result.AggregatePolygonResult'>.", id='no-request')
+15s 128msERROR
ID: [1710756645019, 169994]