Support openeo.api.process.Parameter as resolution in DataCube.resamp…#898
Open
VincentVerelst wants to merge 1 commit into
Open
Support openeo.api.process.Parameter as resolution in DataCube.resamp…#898VincentVerelst wants to merge 1 commit into
VincentVerelst wants to merge 1 commit into
Conversation
soxofaan
reviewed
May 11, 2026
| name=dim.name, | ||
| extent=dim.extent, | ||
| crs=projection, | ||
| step=dim.step, |
Member
There was a problem hiding this comment.
I think it's better to set step to None to more clearly signal that it is unknown at this point, instead of leaving it unchanged (which is the opposite of what is probably happening)
| self, | ||
| resolution: Union[float, Tuple[float, float], List[float]] = 0.0, | ||
| resolution: Union[float, Tuple[float, float], List[float], "Parameter"] = 0.0, | ||
| projection: Union[int, str, None] = None, |
Member
There was a problem hiding this comment.
Also allow projection to be a parameter here, while we're at it?
| ) -> CubeMetadata: | ||
| resolution = normalize_resample_resolution(resolution) | ||
| if isinstance(resolution, Parameter): | ||
| normalized_resolution = None |
Member
There was a problem hiding this comment.
Suggested change
| normalized_resolution = None | |
| normalized_resolution = None, None |
which will allow to simplify the logic below to practically the original code, I guess
| param = Parameter.number("res", description="The spatial resolution.") | ||
| metadata = cube_metadata.resample_spatial(resolution=param) | ||
| assert isinstance(metadata, CubeMetadata) | ||
| # step must not change because the resolution is unknown at build time |
Member
There was a problem hiding this comment.
I think step must be made explicitly unknown: e.g. None
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #897