Skip to content
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

Add aggregate_spatial_window #192

Merged
merged 17 commits into from
Sep 22, 2020
95 changes: 95 additions & 0 deletions aggregate_spatial_window.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
{
"id": "aggregate_spatial_window",
"summary": "Zonal statistics for rectangular windows",
"description": "Aggregates statistics over the spatial dimensions. This process passes a list of values to the reducer.\n\nThe results are computed dividing the input X/Y grid into x_size/y_size non-overlapping windows and applying the reducer process to each window.\nIf X and Y are not multiple of x_size/y_size NaNs padding before the computation is applied.",
clausmichele marked this conversation as resolved.
Show resolved Hide resolved
m-mohr marked this conversation as resolved.
Show resolved Hide resolved
"categories": [
"cubes",
"aggregate & resample"
],
"parameters": [
{
"name": "data",
"description": "A raster data cube.",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it have constraints? It seems like the input raster data cube must have only two dimensions? x and y...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the implementation I am working on, it just needs to have x and y, if it is a timeseries then it will be applied on the full timeseries and return another timeseries. So the datacube dimensions could be (time,x,y) or (x,y) or (band,x,y) or (time,band,x,y) and so on. But we can also choose to limit it to 2d datacubes to ease the implementation.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's discuss later in the meeting.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This still needs clarification

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about:
"description": "A raster data cube with two spatial dimensions and arbitrary number of bands and times. If the datacube has multiple bands the process will be applied to all of them. Same for a timeseries."

Sorry I'm not good in writing this kind of descriptions.

"schema": {
"type": "object",
"subtype": "raster-cube"
}
},
{
"name": "reducer",
"description": "A reducer to be applied on all values of each geometry. A reducer is a single process such as ``mean()`` or a set of processes, which computes a single value for a list of values, see the category 'reducer' for such processes.",
clausmichele marked this conversation as resolved.
Show resolved Hide resolved
"schema": {
"type": "object",
"subtype": "process-graph",
"parameters": [
{
"name": "data",
"description": "An array with elements of any type.",
"schema": {
"type": "array",
m-mohr marked this conversation as resolved.
Show resolved Hide resolved
"items": {
"description": "Any data type."
}
}
},
{
"name": "context",
"description": "Additional data passed by the user.",
"schema": {
"description": "Any data type."
},
"optional": true,
"default": null
}
]
}
},
{
"name": "x_size",
clausmichele marked this conversation as resolved.
Show resolved Hide resolved
"description": "Window size along X or Longitude. The number of values used as input to the reducer along X dimension.",
clausmichele marked this conversation as resolved.
Show resolved Hide resolved
"schema": {
"type": "number"
clausmichele marked this conversation as resolved.
Show resolved Hide resolved
},
"optional": true,
"default": 1
},
{
"name": "y_size",
"description": "Window size along Y or Latitude. The number of values used as input to the reducer along Y dimension.",
clausmichele marked this conversation as resolved.
Show resolved Hide resolved
"schema": {
"type": "number"
clausmichele marked this conversation as resolved.
Show resolved Hide resolved
},
"optional": true,
"default": 1
},
{
"name": "boundary",
"description": "Operation to apply if X/Y are not multiple of x_size/y_size. Options are:\n\n- pad (default): pad the datacube with NaNs to fit window dimensions.\n\n- trim: trim the datacube to fit window dimensions.",
m-mohr marked this conversation as resolved.
Show resolved Hide resolved
"schema": {
"type": "string",
"enum": [
"pad",
"trim"
]
},
"optional": true,
"default": "pad"
},
{
"name": "context",
"description": "Additional data to be passed to the reducer.",
"schema": {
"description": "Any data type."
},
"optional": true,
"default": null
}
],
"returns": {
"description": "A vector data cube with the computed results.\n\nX and Y dimensions will be smaller compared to the input datacube.",
clausmichele marked this conversation as resolved.
Show resolved Hide resolved
"schema": {
"type": "object",
"subtype": "vector-cube"
clausmichele marked this conversation as resolved.
Show resolved Hide resolved
}
}
}