Skip to content
This repository was archived by the owner on Mar 6, 2023. It is now read-only.
This repository was archived by the owner on Mar 6, 2023. It is now read-only.

Handle empty filelist on load_collection #50

@sophieherrmann

Description

@sophieherrmann

Current behavior:

If no dataset matches the constraints in load_collection (and probably the same issue appears in load_results) an error is thrown

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/openeo-processes-python/src/openeo_processes/utils.py", line 116, in fun_wrapper
    return cls_fun(*args, **kwargs)
  File "/usr/local/openeo-processes-python/src/openeo_processes/cubes.py", line 85, in exec_odc
    return odc_load_helper(odc_cube, odc_params)
  File "/usr/local/openeo-processes-python/src/openeo_processes/cubes.py", line 38, in odc_load_helper
    return datacube.to_array(dim='bands')
  File "/opt/conda/lib/python3.8/site-packages/xarray/core/dataset.py", line 5127, in to_array
    data = duck_array_ops.stack([b.data for b in broadcast_vars], axis=0)
  File "/opt/conda/lib/python3.8/site-packages/xarray/core/duck_array_ops.py", line 317, in stack
    return _stack(as_shared_dtype(arrays), axis=axis)
  File "/opt/conda/lib/python3.8/site-packages/xarray/core/duck_array_ops.py", line 217, in as_shared_dtype
    out_type = dtypes.result_type(*arrays)
  File "/opt/conda/lib/python3.8/site-packages/xarray/core/dtypes.py", line 181, in result_type
    return np.result_type(*arrays_and_dtypes)
  File "<__array_function__ internals>", line 5, in result_type
ValueError: at least one array or dtype is required

The log is difficult to read / understand.

Expected behavior

A nicely formatted error message would improve readability

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions