-
Notifications
You must be signed in to change notification settings - Fork 14
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 apply_neigborhood #215
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: SwamyDev
Tagging the VITO team @jdries @soxofaan @JeroenVerstraelen @VincentVerelst here, since they have it implemented and using it frequently. As you noticed, I guess that the case with a kernel of size=2 and stride=1 is not covered by this definition, but I might be wrong. For the scenario where your process takes as input a 3x3 patch, and computes one value out of it, you should set size=1 and overlap=1. Anyway, I wait for some clarification from the others, since I also have some doubts on how the window/neighborhood "moves", so how is the Official docs are here: https://processes.openeo.org/#apply_neighborhood |
As I understand it now this would yield a stride of 2. |
I think the source of the confusion is that you should not aim for a "stride" in the
Within such a chunk you as a user are still allowed to implement some kind of operation that involves strides, but that should not be coupled to the I hope this clarifies some things already |
Then I might have to rephrase a little. Given the xarray example above, which is a common spatial/image analysis operation, what would be the openEO equivalent for a rolling kernel? |
For that particular example: taking sum in 3x3 window and stepping 1px at a time, I would use |
What further adds to the confusion is that the openEO cookbook says: a) that the function is a moving window, and b) that it allows supplying pre-defined processes like |
that b part comes from the following I guess, but I'm not sure where that a part comes from This cookbook snippet is indeed misleading. |
I just stumbled across this example in the introduction of openEO datacubes. https://openeo.org/documentation/1.0/datacubes.html Also here it is suggested that
|
You can indeed use
I didn't intend to say that it is for spatial chunking only. Historically, spatial chunking was the main goal, but temporal chunking was added as a logical generalization. Going back to the beginning of this thread. If you look at I hope this clarifies some things already |
This is an initial attempt to implement
apply_neighborhood
while adhering to the openeo specifications. We have some difficulty understanding the proper implementation of the parameterssize
andoverlap
. More specifically we would like to understand better how those parameters translate to the stride of the rolling window/kernel. In our current understanding the overlap argument modifies the size argument, to obtain a modified kernel/window size.In pseudo code:
This definition implies that in order to obtain a rolling window/kernel with e.g., stride 1 and size 2 requires a 0-size and 1-overlap input for the openEO process. Or, for an instance with stride 1 and size 3, one needs negative size values, specifically -1 and 2 for the size and overlap parameters, respectively. This definition seems therefore impractical for stride 1 rolling windows/kernels. The unit tests of our PR include examples of these two instances in openEO with an input cube of size 4 by 4 filled with values 1 using the process
sum
.By contrast, in xarray a stride 1-rolling kernel can be defined as follows:
It feels like we are missing some important aspect but we can't tell what.
See also this animation of an 3 by 3 kernel with stride 1 from an article on medium.com authored by Paul-Louis Pröve.
Co-authored-by: @SwamyDev