Open-EO / openeo-python-client

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

avoid "No cube:dimensions metadata" warning or errors from `datacube_from_process` #442

Closed soxofaan closed 1 year ago

soxofaan commented 1 year ago

connection.datacube_from_process() causes

openeo-python-client/openeo/metadata.py:255: UserWarning: No cube:dimensions metadata
  complain("No cube:dimensions metadata")

which is not very helpful and can not be avoided because there is not really a way to provided expected metadata

datacube_from_process should not trigger that warning by default (or it should make it possible/easy to specify metadata)

soxofaan commented 1 year ago

another use case:

cube = connection.datacube_from_process(...
cube.apply_dimension(dimension="t", ...

fails with

ValueError: Invalid dimension 't'. Should be one of []

Now, the user is forced to explicitly add define the dimensions clientside in order to get the apply_dimension working. For example, between the datacube_from_process and apply_dimension:

from openeo.metadata import TemporalDimension
cube = cube.metadata._dimensions.append(TemporalDimension(name="t", extent=date))

I think it would be better to skip the client-side dimension checks when there is no metadata, as the backend will complain anyway if something is wrong

soxofaan commented 1 year ago

related issues:

soxofaan commented 1 year ago

merged