You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It looks like we can create a valid process graph from multiple datacubes, as long as we use the same flattener.
week = s2cube.aggregate_temporal_period(period="week",reducer="median")
month = s2cube.aggregate_temporal_period(period="month",reducer="median")
cube1=week.save_result("netCDF")
cube2 = month.save_result("netCDF")
from openeo.internal.graph_building import GraphFlattener
flattener = GraphFlattener()
dict1 = flattener.flatten(cube1.result_node())
#only one node can be marked as 'result':True, so set all others to False
for v in dict1.values():
v["result"] = False
secondary_result = cube2.result_node()
#by reusing the flattener, the previously flattened nodes are also included
dict2 = flattener.flatten(secondary_result)
final_graph = {"process_graph":dict2}
import json
merged = json.dumps(final_graph, indent=2)
print(merged)
connection = openeo.connect("openeo.dataspace.copernicus.eu")
connection.create_job(final_graph,title="job with 2 save results")
In the python client we already have a base class _ProcessGraphAbstraction, which is further implemented by DataCube, VectorCube, MlModel. So I was thinking along the lines of creating another subclass of that, say ProcessGraph or MultiResult, which you can pass one or more cubes and work with that. E.g.
Activity
jdries commentedon Aug 14, 2024
It looks like we can create a valid process graph from multiple datacubes, as long as we use the same flattener.
jdries commentedon Aug 14, 2024
so way forward is either updating create_job or a variant of that method that accepts multiple datacubes?
or
cube.execute_batch(args..., extra_cubes=[extra_cube1])or
connection.execute_batch([cube1,cube2]), other args...)soxofaan commentedon Aug 19, 2024
In the python client we already have a base class
_ProcessGraphAbstraction, which is further implemented byDataCube,VectorCube,MlModel. So I was thinking along the lines of creating another subclass of that, sayProcessGraphorMultiResult, which you can pass one or more cubes and work with that. E.g.(all naming up for discussion of course)
Improve auto-adding of save_result (#623, #401, #583, #391)
fixup! Improve auto-adding of save_result (#623, #401, #583, #391)
fixup! fixup! Improve auto-adding of save_result (#623, #401, #583, #391
PR #630 better "weak" format handling in `execute_batch` (#623, #401, #…
PR #630 improve save_result handling in VectorCube too (#623, #401, #583
Improve auto-adding of save_result (#623, #401, #583, #391)
PR #630 better "weak" format handling in `execute_batch` (#623, #401, #…
7 remaining items
Issue #391 support shared PGNodes better in MultiResult
Issue #391 avoid multiple "result" modes with MultiResult flattening
Issue #391/#651 add docs, changelog, review tweaks
fixup! Issue #391/#651 add docs, changelog, review tweaks
Issue #391/#651 review tweaks
fixup! Issue #391/#651 review tweaks
Issue #391 Initial implementation of MultiResult
Issue #391 support shared PGNodes better in MultiResult
Issue #391 avoid multiple "result" modes with MultiResult flattening
Issue #391/#651 add docs, changelog, review tweaks
Issue #391/#651 more review tweaks
soxofaan commentedon Nov 5, 2024
ready to merge:
just waiting for quick review if possible
Issue #391/#651 import MultiResult in toplevel openeo package
soxofaan commentedon Nov 6, 2024
merged #651