You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for the awesome work on this library! It's an awesome contribution to the xarray ecosystem. 🙏
xarray_reduce has a mandatory keyword-only argument func, which is the same name used by xarray.DataArray.pipe.
This breaks use of xarray_reduce in .pipe, where it'd otherwise be a very natural fit for fluent interfaces of the form:
ds: xa.Dataset= ... needfulloadofdataset ...
# error, func keyword argument is captured by .pipe ds.pipe(xarray_reduce, "group_coordinate", func="mean")
Though I think it'd be natural-ish for .pipe to use a positional-only argument for func,
or the python convention for a dunder-prefixed positional argument (i.e. __func),
that ship probably sailed a long time ago...
Flox can fix this behavior to fit into .pipe by changing the name of func.
I would, personally, recommend using method signatures closer to the xarray standard,
where one-or-more dimensions are represented as a single argument dims : Hashable | list[Hashable].
but this is (obviously) a breaking change and probably requires a method rename + shim.
Maybe, for discoverabilities sake, this could be a new method flox.xarray.groupby_reduce?
xarray-einstats.einops.reduce is a good example of a "pipeable", "unbound" or "xarray extension" compatible interfaces.
The text was updated successfully, but these errors were encountered:
Thanks for the awesome work on this library! It's an awesome contribution to the xarray ecosystem. 🙏
xarray_reduce
has a mandatory keyword-only argumentfunc
, which is the same name used byxarray.DataArray.pipe
.This breaks use of
xarray_reduce
in.pipe
, where it'd otherwise be a very natural fit for fluent interfaces of the form:Though I think it'd be natural-ish for
.pipe
to use a positional-only argument forfunc
,or the python convention for a dunder-prefixed positional argument (i.e.
__func
),that ship probably sailed a long time ago...
Flox can fix this behavior to fit into
.pipe
by changing the name offunc
.I would, personally, recommend using method signatures closer to the xarray standard,
where one-or-more dimensions are represented as a single argument
dims : Hashable | list[Hashable]
.This would look like:
but this is (obviously) a breaking change and probably requires a method rename + shim.
Maybe, for discoverabilities sake, this could be a new method
flox.xarray.groupby_reduce
?xarray-einstats.einops.reduce
is a good example of a "pipeable", "unbound" or "xarray extension" compatible interfaces.The text was updated successfully, but these errors were encountered: