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

kernel orientation in apply_kernel #165

Closed
soxofaan opened this issue Jul 1, 2020 · 7 comments · Fixed by #166
Closed

kernel orientation in apply_kernel #165

soxofaan opened this issue Jul 1, 2020 · 7 comments · Fixed by #166

Comments

@soxofaan
Copy link
Member

soxofaan commented Jul 1, 2020

"description": "A two-dimensional weighted kernel. Each dimension of the kernel must have an uneven number of elements, otherwise the process throws a `KernelDimensionsUneven` error.",

I think the spec should specify explicitly how the levels of the nested array correspond with the x and y dimension.

I think in most languages (python/numpy, matlab, ...), the inner level corresponds with the x dimension and outer level corresponds with the y dimension, because that is the most intuitive way to render it:

array([[1, 2],
       [3, 4]])

But I don't think we should let this open for interpretation

@m-mohr m-mohr added this to the v1.0-final milestone Jul 1, 2020
@m-mohr
Copy link
Member

m-mohr commented Jul 1, 2020

Good point. One could also argue it should be based on the given CRS though.

@soxofaan
Copy link
Member Author

soxofaan commented Jul 1, 2020

initial quick proposal:

>             "description": "Weighted kernel as a two-dimensional array. The inner level of the nested array corresponds to the `x` dimension and the outer level corresponds to the `y` dimension. Each dimension of the kernel must have an uneven number of elements, otherwise the process throws a `KernelDimensionsUneven` error.",

@soxofaan
Copy link
Member Author

soxofaan commented Jul 1, 2020

One could also argue it should be based on the given CRS though

Or to drive this even further: why limit this to 2-D spatial? Why not also support use cases with data cubes with 3 spatial dimensions or just 1? And why not also allow convolution along temporal dimension?
This could be addressed by adding a parameter, say dimensions, that is a list of dimension names corresponding with the levels of the nested kernel array (so e.g. ["y", "x"] by default if you use outer-to-inner order)

@m-mohr
Copy link
Member

m-mohr commented Jul 1, 2020

We allowed more dimensions in apply_kernel previously, but we changed that for a reason I can't clearly remember. Maybe just for simplicity.

Related issues/PRs: #69 / #118

@soxofaan
Copy link
Member Author

soxofaan commented Jul 1, 2020

yeah I thought that would have been considered before. I'm fine with 2-D for now, I guess it can be expanded later in backwards compatible fashion

@soxofaan
Copy link
Member Author

soxofaan commented Jul 1, 2020

Side track while we're at it: the summary is pretty vague IMHO:

"summary": "Apply a kernel to compute pixel-wise values",

I would at least include the key word "convolution" there, e.g.

Apply a convolution with a kernel

@m-mohr
Copy link
Member

m-mohr commented Jul 1, 2020

I'm happy to accept PRs for any of the suggested changes.

soxofaan added a commit to soxofaan/openeo-processes that referenced this issue Jul 1, 2020
soxofaan added a commit to soxofaan/openeo-processes that referenced this issue Jul 1, 2020
@m-mohr m-mohr linked a pull request Jul 2, 2020 that will close this issue
soxofaan added a commit to soxofaan/openeo-processes that referenced this issue Jul 2, 2020
m-mohr added a commit that referenced this issue Jul 6, 2020
@m-mohr m-mohr closed this as completed Jul 6, 2020
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