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

result_meta dimension in aggregate_spatial #356

Closed
soxofaan opened this issue Mar 23, 2022 · 6 comments · Fixed by #382
Closed

result_meta dimension in aggregate_spatial #356

soxofaan opened this issue Mar 23, 2022 · 6 comments · Fixed by #382
Assignees
Milestone

Comments

@soxofaan
Copy link
Member

The devtelco of this afternoon led me to this " total_count and valid_count" feature of aggregate_spatial I was not aware of.

"description": "A vector data cube with the computed results and restricted to the bounds of the geometries.\n\nThe computed value is used for the dimension with the name that was specified in the parameter `target_dimension`.\n\nThe computation also stores information about the total count of pixels (valid + invalid pixels) and the number of valid pixels (see ``is_valid()``) for each geometry. These values are added as a new dimension with a dimension name derived from `target_dimension` by adding the suffix `_meta`. The new dimension has the dimension labels `total_count` and `valid_count`.",

The computation also stores information about the total count of pixels (valid + invalid pixels) and the number of valid pixels for each geometry. These values are added as a new dimension with a dimension name derived from target_dimension by adding the suffix _meta. The new dimension has the dimension labels total_count and valid_count.

I'm not sure this makes sense: you can not just "add a new dimension" to append metadata

For example, assume the input raster cube is a 2D (x,y) raster cube

Purely looking at the aggregation results, the output is also a 2D vector cube with a vector dimension (with a label for each geometry) and a "result" dimension (with just a single item, e.g. label "aggregation"). Attempt to visualize:

"aggregation"
geom1 1.23
geom2 4.56
... ...

First observation: the "result" dimension is actually not necessary, the result could just be a 1D vector cube.

Now about the result_meta dimension and its labels total_count and valid_count. If you simply "add" this dimension, then you get a 3D vector cube, with dimensions:

  • vector dimension (labels geom1, geom2, ...)
  • "result" dimension (single label, e.g. "aggregation")
  • "result_meta" dimension (labels "total_count", "valid_count")

but your aggregations are lost here: at what coordinates in this cube is the original aggregation stored? This result cube has only metadata.

I think what is intended is that total_count and valid_count should be new labels in the "result" dimension.
So the "result" dimension would have labels "aggregation", "total_count", "valid_count"

@soxofaan
Copy link
Member Author

@soxofaan
Copy link
Member Author

also related to the discussion around #341 (comment)

@m-mohr
Copy link
Member

m-mohr commented Mar 23, 2022

Yes, I also stumbled across this recently and it needs to be rephrased based also on the vector cube definition later.
One potential solution is indeed what you proposed and is also given as an example in the mentioned discussion: #341 (comment)

@m-mohr m-mohr self-assigned this Mar 23, 2022
@m-mohr m-mohr added this to the 1.3.0 milestone Mar 23, 2022
@soxofaan
Copy link
Member Author

is also given as an example in the mentioned discussion: #341 (comment)

with the difference, I think, that the "result" and "band" dimension should be separate, instead of flattened as in that example

@m-mohr
Copy link
Member

m-mohr commented Mar 23, 2022

How should that work? You did argue above that this doesn't work if I understood it correctly?

@soxofaan
Copy link
Member Author

How should that work?

It's like my original example, but one additional dimension:

start from 3D raster cube: (x, y, bands)
output should be (I think): 3D vector cube:

  • vector dimension
  • band dimension (like original input)
  • "result" dimension with labels "aggregation" (or something alike), "total_count", "valid_count"

@m-mohr m-mohr linked a pull request Sep 7, 2022 that will close this issue
14 tasks
@m-mohr m-mohr closed this as completed Jan 31, 2023
@m-mohr m-mohr modified the milestones: 1.3.0, 2.0.0 Feb 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants