Fix DataArray.integrate API inconsistency - change 'dim' parameter to 'coord' #3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.



This PR fixes an API inconsistency in the
DataArray.integratemethod where it used adimparameter while all other related methods consistently usecoord.Problem
The API was inconsistent across differentiation and integration methods:
As noted in the issue, this inconsistency is confusing because "it doesn't make sense to integrate or differentiate over a dim because a dim by definition has no information about the distance between grid points." The operation should be performed over coordinates, not dimensions.
Solution
Changed
DataArray.integrateto usecoordparameter for consistency:integrate(dim=...)→integrate(coord=...)coordparameter correctlyBackward Compatibility
Existing code using positional arguments continues to work unchanged:
Only keyword argument usage changes:
Result
All differentiation and integration methods now have consistent APIs:
This makes the API more intuitive and aligns with the principle that integration and differentiation operate on coordinates, not dimensions.
Fixes #1.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.