-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
Description
We currently have two types of methods that take a function to apply to xarray objects:
pipe(onDataArrayandDataset): apply a function to this entire object (array.pipe(func)->func(array))apply(onDatasetandGroupBy): apply a function to each labeled object in this object (e.g.,ds.apply(func)->ds({k: func(v) for k, v in ds.data_vars.items()})).
And one more method that we want to add but isn't finalized yet -- currently named apply_ufunc:
- Apply a function that acts on unlabeled (i.e., numpy) arrays to each array in the object
I'd like to have three distinct names that makes it clear what these methods do and how they are different. This has come up a few times recently, e.g., #1130
One proposal: rename apply to map, and then use apply only for methods that act on unlabeled arrays. This would require a deprecation cycle, but eventually it would let us add .apply methods for handling raw arrays to both Dataset and DataArray. (We could use a separate apply method from apply_ufunc to convert dim arguments to axis and not do automatic broadcasting.)
Reactions are currently unavailable