-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
apply_polygon: callback on pixels inside a polygon #287
Comments
@jdries Sounds interesting (and complex ;-) ). I'm a big confused because the first paragraph sounds a bit like you'd need a special filter_* function, but then the proposal is apply_*, which is somewhat different. I'm also not sure I'm fully understanding the apply_spatiotemporal proposal as to what the inputs and output(s) exactly are. What's the priority on this (e.g. compared to SRR3 Platform use cases)? |
The suggested process: apply_spatial_temporal(code=None, runtime=None, process=None, version='latest', geometries)
The UDF function is applied per geometry (= parcel).
@m-mohr Is the name of the process in line with the rest of the API, or should it be one of:
|
I'm happy to provide a process description for this. Please keep in mind that run_udf and the new process would probably not be joined like in your example. While you can do that in Python the openEO processes would be more generic. I'll try to get a draft something today. I do not understand everything regarding this process yet though, so the proposal may be somewhat off, but can get us started better. For example, what is the required input cube? What happens to bands? How is the result of the callbacks merged? Why is this called spatiotemporal although the geometries are just spatial? Should this work just for polygons or all types of geometries (lines, points)? Regarding the name, I'm not 100% sure. First of all, apply is usually pixel-level, but here we work on data cubes in the callback so it seems something like "chunk" could git better. Currently, we use "spatial" and "temporal" in process names, but never the combination. So maybe spatiotemporal? So the resulting name could be Interesting how this use-case now somewhat contradicts with PR #286. |
A first idea that would be used like this (pseudo-code):
Process: {
"id": "chunk_polygon",
"summary": "Apply a process to spatial chunks of a data cube",
"description": "The given data cube is chunked by the given polygons and applies the given process to each individual chunk.",
"categories": [
"cubes"
],
"parameters": [
{
"name": "data",
"description": "A data cube.",
"schema": {
"type": "object",
"subtype": "raster-cube"
}
},
{
"name": "chunks",
"description": "A GeoJSON object containing at least one polygon. The provided feature types can be one of the following:\n\n* A `Polygon` or `MultiPolygon` geometry,\n* a `Feature` with a `Polygon` or `MultiPolygon` geometry,\n* a `FeatureCollection` containing at least one `Feature` with `Polygon` or `MultiPolygon` geometries, or\n* a `GeometryCollection` containing `Polygon` or `MultiPolygon` geometries. To maximize interoperability, `GeometryCollection` should be avoided in favour of one of the alternatives above.",
"schema": {
"type": "object",
"subtype": "geojson"
}
},
{
"name": "process",
"description": "A process that accepts and returns a single data cube and is applied on each individual chunk. The process may consist of multiple sub-processes.",
"schema": {
"type": "object",
"subtype": "process-graph",
"parameters": [
{
"name": "data",
"description": "A chunk of the original data cube.",
"schema": {
"type": "object",
"subtype": "raster-cube"
}
},
{
"name": "context",
"description": "Additional data passed by the user.",
"schema": {
"description": "Any data type."
},
"optional": true,
"default": null
}
],
"returns": {
"description": "The updated data cube.",
"schema": {
"description": "A data cube.",
"schema": {
"type": "object",
"subtype": "raster-cube"
}
}
}
}
},
{
"name": "context",
"description": "Additional data to be passed to the process.",
"schema": {
"description": "Any data type."
},
"optional": true,
"default": null
}
],
"returns": {
"description": "A data cube with the newly computed values and the same dimensions. The dimension properties (name, type, labels, reference system and resolution) remain unchanged.",
"schema": {
"type": "object",
"subtype": "raster-cube"
}
}
} This is probably not working for your use-case yet, but there are also several open questions (see above). We need to clarify them first. Maybe it's a good idea to initiate a call to discuss it. |
I think the chunk_polygon proposal could indeed work. |
Added PR #298 so that we can discuss it better. |
the experimental chunk_polygon process is now available on the vito backend |
We received the following use case to support:
So question is how we could support this?
Proposal 1 'apply_spatiotemporal'
We already have processes like 'aggregate_spatial' and 'apply_neighbourhood'. So an 'apply_spatiotemporal' process could receive the input polygons, and simply apply a function to the timeseries of pixels within that polygon, receiving a labeled array as input? The output is then again a labeled array with updated pixel values.
In our case, the callback would probably be a UDF.
The text was updated successfully, but these errors were encountered: