Skip to content

Add scalar dot gradient#1500

Merged
erogluorhan merged 6 commits into
mainfrom
rajeeja/scalardotgradient_539
Jun 18, 2026
Merged

Add scalar dot gradient#1500
erogluorhan merged 6 commits into
mainfrom
rajeeja/scalardotgradient_539

Conversation

@rajeeja

@rajeeja rajeeja commented Apr 28, 2026

Copy link
Copy Markdown
Contributor

Adds UxDataArray.scalardotgradient for computing the dot product between a vector field and scalar-field gradient. Closes #539.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new vector-calculus helper on UxDataArray to compute the dot product between a (u, v) vector field and the gradient of a scalar field q, addressing issue #539.

Changes:

  • Implement UxDataArray.scalardotgradient(v, q) to compute u * dq/dx + v * dq/dy for 1D face-centered fields with validation.
  • Add tests that (a) verify the dot product uses the expected gradient components and (b) rejects misaligned face indexes (no silent realignment).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
uxarray/core/dataarray.py Adds the scalardotgradient method with input validation, alignment, and output metadata.
test/core/test_vector_calculus.py Adds MPAS-Ocean-focused tests for scalardotgradient, including a mocked-gradient correctness test and a misalignment error test.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread uxarray/core/dataarray.py Outdated

@erogluorhan erogluorhan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking great; can you add a quick example of it into the Vector Calculus user guide, then we can get it merged. Thanks!

@rajeeja rajeeja force-pushed the rajeeja/scalardotgradient_539 branch 2 times, most recently from 4972c69 to 53e4cee Compare June 8, 2026 20:47
@rajeeja rajeeja force-pushed the rajeeja/scalardotgradient_539 branch from 53e4cee to ceae73f Compare June 15, 2026 21:27

@erogluorhan erogluorhan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This still needs an entry into the vector calculus user guide per the previous review cycle. One it is done, this should be good to go.

@review-notebook-app

Copy link
Copy Markdown

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@erogluorhan erogluorhan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for adding this!

@erogluorhan erogluorhan merged commit 2a6cf00 into main Jun 18, 2026
13 checks passed
@erogluorhan erogluorhan deleted the rajeeja/scalardotgradient_539 branch June 18, 2026 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dot Product between a Vector Field and Scalar Field

3 participants