Skip to content

[doc] example code for reading the default MD_DIMS#3470

Open
pieleric wants to merge 1 commit into
delmic:masterfrom
pieleric:doc-example-code-for-reading-the-default-md_dims
Open

[doc] example code for reading the default MD_DIMS#3470
pieleric wants to merge 1 commit into
delmic:masterfrom
pieleric:doc-example-code-for-reading-the-default-md_dims

Conversation

@pieleric
Copy link
Copy Markdown
Member

The default value is explained in _metadata.py in English.
Explicitly give the equivalent Python version, as it's not obvious to
come up with it.

Copilot AI review requested due to automatic review settings May 27, 2026 09:31
@pieleric pieleric requested a review from tmoerkerken May 27, 2026 09:32
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 27, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7292ea41-1784-454d-a7d1-e58c162f265d

📥 Commits

Reviewing files that changed from the base of the PR and between 1d2cf21 and daae076.

📒 Files selected for processing (1)
  • doc/develop/backend-api.rst
✅ Files skipped from review due to trivial changes (1)
  • doc/develop/backend-api.rst

📝 Walkthrough

Walkthrough

This PR adds a documentation note to the backend API guide clarifying how to interpret MD_DIMS when it is undefined. It explains that the default dimension order should be derived from DataArray.ndim and gives the snippet: dims = data.metadata.get(model.MD_DIMS, "CTZYX"[-data.ndim::]).

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding example code documentation for reading the default MD_DIMS value.
Description check ✅ Passed The description clearly explains the purpose of the change: providing an explicit Python code example for the default MD_DIMS logic that was previously only documented in English comments.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the developer backend API documentation to make the implied default MD_DIMS (“CTZYX” with leading dimensions dropped to match data.ndim) easier to apply by providing an explicit Python access pattern.

Changes:

  • Added a .. note:: describing that MD_DIMS may be unset and how to derive the default order.
  • Included a Python one-liner showing how to read MD_DIMS with a fallback derived from data.ndim.

Comment thread doc/develop/backend-api.rst Outdated
Comment thread doc/develop/backend-api.rst Outdated
Comment on lines +628 to +629
``dims = data.metadata.get(model.MD_DIMS, "CTZYX"[-data.ndim::])``

Comment thread doc/develop/backend-api.rst Outdated
Comment thread doc/develop/backend-api.rst Outdated
Comment thread doc/develop/backend-api.rst Outdated
The default value is explained in _metadata.py in English.
Explicitly give the equivalent Python version, as it's not obvious to
come up with it.
@pieleric pieleric force-pushed the doc-example-code-for-reading-the-default-md_dims branch from 1d2cf21 to daae076 Compare May 29, 2026 15:44
@pieleric pieleric requested a review from tmoerkerken May 29, 2026 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants