Open-EO / openeo-python-client

Python client API for OpenEO
https://open-eo.github.io/openeo-python-client/
Apache License 2.0
146 stars 37 forks source link

DataCube.save_result returns DataCube instead of (wrapped) true #402

Open soxofaan opened 1 year ago

soxofaan commented 1 year ago

related to #401, https://github.com/Open-EO/openeo-processes/issues/334, https://github.com/Open-EO/openeo-processes/pull/401

DataCube.save_result returns a DataCube, while it technically should return true (wrapped in _ProcessGraphAbstraction, to allow calling .download(), .create_job, ...)

clausmichele commented 1 year ago

@soxofaan as far as I understand, the return value of save_result mentioned is what the process should return when executed in the back-end, and not something that the client should take care of. @m-mohr do I understand it correctly?

soxofaan commented 1 year ago

This ticket is purely about the python client side: The Python method DataCube.save_result currently returns a (new) DataCube instance, which allow the user to call things like aggregate_spatial or reduce_dimension on that:

cube = con.load_collection(...)
result = cube.save_result(...)
result = result.reduce_dimension(...)

which makes no sense (because the output of the save_result openEO process is a boolean), so the client should not allow that.

Instead, the DataCube.save_result should return something that still supports .download(), .execute_batch() and alike, but not allow all the data processing methods like aggregate_spatial, ...

clausmichele commented 1 year ago

Ok now I get it!

soxofaan commented 1 year ago

having a dedicated "save_result" object will also simplify the save_result related checks and format guessing hacks from #401/#449