-
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
feat: Implementation of resample_spatial to reproject values #103
Conversation
Codecov Report
@@ Coverage Diff @@
## main #103 +/- ##
==========================================
+ Coverage 78.82% 78.95% +0.12%
==========================================
Files 27 28 +1
Lines 1176 1207 +31
==========================================
+ Hits 927 953 +26
- Misses 249 254 +5
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Just to leave it here too: Since opendatacube/odc-geo#88 came out, it would probably be good to see whether this already does this! |
Switched implementation to use the odc.reproject function, much less code to maintain now! @ValentinaHutter One thing I'm not sure on. Odc reproject will automatically resample the raster to the provided projection. In the case a user provides no resolution to resample, and only wants a reproject, should we force the resolution of the input cube? Or just use accept resolution as none? Not sure what the preference would be. |
@ValentinaHutter One other concern, we've no way or reliably enforcing the convention of the user specifying the target resolution in the units of the output crs. Scao recommended this could be enforced with accepted rangers for different CRsystems. Example, if the user incorrectly specifies 0.0009 as their output resolution, and the crs is in metres, this will run for longer. Not sure how much longer on dask, so may not be a huge concern. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
openeo_processes_dask/process_implementations/cubes/resample.py
Outdated
Show resolved
Hide resolved
In https://processes.openeo.org/#resample_spatial the default resolution=0 and says that it |
Hm, it sounds quite complicated to check this with different ranges for every crs, what do you think? Also, the definition says, that the resolution is |
openeo_processes_dask/process_implementations/cubes/resample.py
Outdated
Show resolved
Hide resolved
Using odc.geo 0.4.1, I was unable to reproduce what we saw last month one both fake and real (sen2like output) data. Fixed odc minimum version to 0.4.1, fixed tests and accessor import for odc, and reviewed output arrays with @LukeWeidenwalker! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good! Couple of minor comments, but once these are resolved we should be able to finally merge this!
openeo_processes_dask/process_implementations/cubes/resample.py
Outdated
Show resolved
Hide resolved
openeo_processes_dask/process_implementations/cubes/resample.py
Outdated
Show resolved
Hide resolved
openeo_processes_dask/process_implementations/cubes/resample.py
Outdated
Show resolved
Hide resolved
openeo_processes_dask/process_implementations/cubes/resample.py
Outdated
Show resolved
Hide resolved
openeo_processes_dask/process_implementations/cubes/resample.py
Outdated
Show resolved
Hide resolved
openeo_processes_dask/process_implementations/cubes/resample.py
Outdated
Show resolved
Hide resolved
Co-authored-by: Lukas Weidenholzer <17790923+LukeWeidenwalker@users.noreply.github.com>
Co-authored-by: Lukas Weidenholzer <17790923+LukeWeidenwalker@users.noreply.github.com>
Co-authored-by: Lukas Weidenholzer <17790923+LukeWeidenwalker@users.noreply.github.com>
Co-authored-by: Lukas Weidenholzer <17790923+LukeWeidenwalker@users.noreply.github.com>
…eo-processes-dask into DP-277-add-resample-spatial
Ahh, two more things:
|
spec added in eodcgmbh/openeo-processes |
@SerRichard I have a question: after putting so much work into this process implementation, did you ever test it with an openEO process graph? Because currently it is not imported here https://github.com/Open-EO/openeo-processes-dask/blob/main/openeo_processes_dask/process_implementations/cubes/__init__.py and therefore can't be used. |
(Edit: my supposition was wrong, see comments below) Additionally, not exposing a parameter like @soxofaan does the Python client always add to the process graph all the optional parameters with default values? |
no we don't always automatically add the default value of unset parameters, it depends a bit on details of In case of |
Actually, it's the opposite. It's meant to be that if something is not supported, it's not exposed. Process definitions should reflect the implementation status.
I think this should be changed. It should only be sent if not the default value and supported by the back-end. |
Thanks @m-mohr, so as you said, the Python Client needs to be adjusted. |
IMO, in case of an argument like 'align', where a backend may not support multiple options but does support one of them, why would it not be good to put this in the backend process spec? Listing the single-value in the enum would be a way to convey important information in a standardized manner, and can solve the issue with defaults. |
Yes, you are right. If one value is supported, the backend should change the schema accordingly so that it requires exactly that value. If a parameter is not supported at all, it should be removed. That still would require some kind of change in the Python client, I think. |
Dask implementation of resample spatial using the odc.algo reproject function. I've tried to handle some trickier parts (like infering the affine transformation) with some helper utils. Ready for review when all boxes are ticked!