Skip to content

Commit

Permalink
"Implode" dimensions #308
Browse files Browse the repository at this point in the history
  • Loading branch information
m-mohr committed Dec 20, 2021
1 parent ffbb927 commit 7807e4c
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased / Draft

### Added

- New processes in proposal state:
- `implode_dimensions`

## [1.2.0] - 2021-12-13

### Added
Expand Down
57 changes: 57 additions & 0 deletions proposals/implode_dimensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"id": "implode_dimensions",
"summary": "Combine multiple dimensions into a single dimension",
"description": "Combines multiple given dimensions into a single dimension by flattening the values and merging the dimension labels with the given `label_separator`. Non-string dimension labels will be converted to strings.\n\nExample: Executing the process with a data cube with two dimensions `A` (labels: `2020` and `2021`) and B (labels: `B1` and `B2`) and the data `[[1,2],[3,4]]` and the parameters `dimensions` = `[A,B]` and `target_dimension` = `X` will result in a data cube with one dimension `X` (labels: `2020~B1`, `2020~B2`, `2021~B1` and `2021~B2`) and the data `[1,2,3,4]`.",
"categories": [
"cubes"
],
"experimental": true,
"parameters": [
{
"name": "data",
"description": "A data cube.",
"schema": {
"type": "object",
"subtype": "raster-cube"
}
},
{
"name": "dimensions",
"description": "The names of the dimension to combine. The order of the array defined the order in which the dimension labels and values are combined.\n\nFails with a `DimensionNotAvailable` exception if one of the specified dimension does not exist.",
"schema": {
"type": "array",
"items": {
"type": "string"
}
}
},
{
"name": "target_dimension",
"description": "The name of an a target dimension with a single dimension label, which will be replaced. If a dimension with the given name doesn't exist yet, it is created with the specified name and the type `other` (see ``add_dimension()``).",
"schema": {
"type": "string"
}
},
{
"name": "label_separator",
"description": "The string that will be used as a separator for the combined dimension labels. The string given must not be contained in any of the dimension labels.",
"optional": true,
"default": "~",
"schema": {
"type": "string"
}
}
],
"returns": {
"description": "A data cube with the new shape. The number of dimensions decreases. The dimension properties (name, type, labels, reference system and resolution) for all other dimensions remain unchanged.",
"schema": {
"type": "object",
"subtype": "raster-cube"
}
},
"exceptions": {
"DimensionNotAvailable": {
"message": "A dimension with the specified name does not exist."
}
}
}

0 comments on commit 7807e4c

Please sign in to comment.