Skip to content

Best practices for "carrying through" type-specific operations to wrapped types #6

@jthielen

Description

@jthielen

In many use cases, we can have "multiply nested" duck arrays rather than just two interacting duck array types. This creates a couple issues:

Note: this issue is mostly relevant to array types higher on DAG, as they are the ones handling the respective interactions.

Current State

Many of the libraries higher on the DAG (e.g., xarray and pint) have some form of attribute fallback to their wrapped data. However, more complex methods/operations often require direct handling (such as rechunking an underlying dask array contained in an xarray data structure) that each library has to implement itself. This approach quickly becomes impractical as many array types become involved (e.g., how can xarray do all of pint, dask, and CuPy operations on a xarray(pint(dask(cupy))) nested array?), especially if there is not a standard way of carrying through these operations "down the stack."

Specific Goals

  • Be able to seamlessly (or as seamlessly as possible) perform wrapped-type-specific operations on wrapper arrays
    • e.g., dask-specific things on a xarray(pint(dask(numpy))) nested array, or sparse-specific things on a pint(dask(sparse)) nested array

Suggested Paths Forward

Discussion

  • Is there guidance (or is there the prospect of some kind of standardization/"best practice" document) on how to perform operations specific to a wrapped array type through a wrapper array type in a way that nests well?

Metadata

Metadata

Assignees

No one assigned

    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