Open-EO / Open-EO/openeo-python-client

Update UDF signature docs for apply_datacube also supporting xarray.DataArray

Open
#534 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

documentation low hanging fruit UDF
Dominant language
Python
Stars
217
Forks
56
Avg merge
1d 22h
Merged PRs (30d)
2

Description

Triggered from discussing #533 with @VictorVerhaert :
the docs on UDF signatures (https://open-eo.github.io/openeo-python-client/udf.html#module-openeo.udf.udf_signatures) should be updated to newly added xarray.DataArray support (#310)

I wanted do it naively by introducing Union[XarrayDataCube, xarray.DataArray] in
https://github.com/Open-EO/openeo-python-client/blob/7ce92925dd9544ff116b14c0339de203f854ec27/openeo/udf/udf_signatures.py#L30

but then realized that that is actually more confusing, as the user is not expected to use Union there.

The user should pick one of

def apply_datacube(cube: XarrayDataCube, context: dict) -> XarrayDataCube:
#or 
def apply_datacube(cube: xarray.DataArray, context: dict) -> xarray.DataArray:

but defining it like that in udf_signatures.py is not going to work (first form will be overwritten by second).

We probably have to port udf_signatures.py from a python file to a RestructuredText file in the docs

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with openeo/udf/udf_signatures.py and the UDF signatures documentation at the linked page. Update the documentation to show separate apply_datacube signatures for XarrayDataCube and xarray.DataArray without suggesting that users should write a Union; the result should accurately describe the newly supported DataArray form.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.