Skip to content

running numpy functions on xarray objects #3917

Open

Description

@keewis

In the pint integration tests I tried to also test calling numpy functions on xarray objects (we provide methods for all of them).

Some of these functions, like numpy.median, numpy.searchsorted and numpy.clip, depend on __array_function__ (i.e. not __array_ufunc__) to dispatch. However, neither Dataset nor DataArray (nor Variable, I think?) define these protocols (see #3643).

Should we define __array_function__ on xarray objects?

Activity

  1. shoyer commented on Apr 9, 2020

    @shoyer
    Member

    I think this is probably a good idea, assuming we figure out the type casting hierarchy challenge. Right now people often check for the existence of __array_function__ to indicate NumPy duck arrays, which clearly isn't quite right.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic-arraysrelated to flexible array support

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions