-
Notifications
You must be signed in to change notification settings - Fork 47
Description
Context
I'm trying to run a UDP from a namespace, using datacube_from_process. I'd like to save my results to a workspace using export_workspace. My UDP already contains one or more save_result nodes, so I don't need/want to add it manually anymore.
Problem
datacube_from_process returns a DataCube object. However, export_workspace only works on a SaveResult object. The following code snippet can be used to replicate the error:
cube = connection.datacube_from_process(
process_id='worldcereal_crop_type',
namespace=namespace,
spatial_extent=spatial_extent,
temporal_extent=temporal_extent,
model_url=model_url,
)
cube = cube.export_workspace(
workspace="worldcereal-phase2-waw4-1-workspace",
merge="worldcereal_global_croptype_benchmark_50km",
)will result in
AttributeError: 'DataCube' object has no attribute 'export_workspace'
Discussion
Would it be possible to allow to call export_workspace directly on a DataCube object? Or, if there's a good reason not to: how can we allow to easily add an export_workspace node to a UDP?
Workaround
For now, I can continue, by adding the following line of code between datacube_from_process and export_workspace:
from openeo.rest.result import SaveResult
cube = SaveResult(cube._pg, connection)