Description
What is your issue?
The type annotations of xarray.Dataset.pipe
, xarray.DataArray.pipe
, and xarray.DataTree.pipe
should be enhanced to address the following shortcomings in terms of what type checkers cannot flag due to the imprecise typing currently in place:
- Incorrect number of arguments
- Incorrect argument types
- Code suggestions for chaining after the
pipe
(only an issue forDatatree.pipe
)
Note that in the case of specifying a tuple (function + keyword) as the first argument to pipe
, only item 3 can be addressed because there's no way to fully specify the function's type signature when the function does not take the dataset/array/tree as its first argument.
In this case, this can be addressed by using a lambda instead. In essence, my recommendation would be for users of pipe
not to use the tuple form so that more robust type checking can be performed.
NOTE: I plan to submit a PR for this issue.