Skip to content

Polish dimensionality demo unit assignment#268

Merged
lmoresi merged 1 commit into
underworldcode:developmentfrom
ss2098:ss2098/polish-dimensionality-demo-array-assignment
Jun 24, 2026
Merged

Polish dimensionality demo unit assignment#268
lmoresi merged 1 commit into
underworldcode:developmentfrom
ss2098:ss2098/polish-dimensionality-demo-array-assignment

Conversation

@ss2098

@ss2098 ss2098 commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

This follow-up to #261 updates docs/examples/Dimensionality-Demo.py to use the public unit-aware .array interface for dimensional assignment.

The previous fix made the demo run by manually writing non-dimensional values into .data. This polish assigns dimensional quantities through .array, for example:

T.array[...] = uw.quantity(1300.0, "kelvin")

and then shows that .data contains the corresponding non-dimensional internal storage.

This better demonstrates the intended units interface:

  • .array for dimensional/unit-aware values
  • .data for non-dimensional internal values

No solver behavior is changed.

Tested with:

pixi run python docs/examples/Dimensionality-Demo.py

Result: script completes successfully.

@lmoresi lmoresi 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 exactly the polish I suggested on #261.array[...] = uw.quantity(value, unit) dimensional assignment instead of manual scaling, plus the .array (dimensional) vs .data (ND) explanation. Verified it runs end-to-end (✅ Dimensional analysis complete). The demo now actually showcases the units interface. Thanks @ss2098!

@lmoresi lmoresi merged commit 3f1f65e into underworldcode:development Jun 24, 2026
1 check passed
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.

2 participants