Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

DataArray aware `pint.context`

Open
#231 5 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
python
Domain
data

Research direction

No files or tests are named. Start by tracing the DataArray.pint.to("nm") accessor and reviewing how Pint contexts and decorators accept variables; clarify whether upstream Pint support is required. Done would mean an agreed API and tests showing a context variable can be obtained from the current DataArray coordinate.

Written by the indexing model from the issue text.

Description

For example, consider the spectroscopy context:

@context(n=1) spectroscopy = sp

There the conversion depends on the variable n used. Now, consider a DataArray/DataSet where n is a dimension/coordinate. Then when calling DataArray.pint.to("nm") we would want the variable n to be dynamically imported from the current context of the DataArray coordinate.

API-wise I am not sure how that would work, maybe by passing a list/dict of context objects (+ variables)? This might also involve upstream pint support for more complicated context and decorators.

Dominant language
Python
Stars
119
Forks
15
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from xarray-contrib/pint-xarray

All issues in xarray-contrib/pint-xarray

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.