Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

store SI-prefixability metadata in the unit registry #21

Merged
merged 1 commit into from
Jun 21, 2018

Conversation

ngoldbaum
Copy link
Member

Rather than keeping a global list of units that can be SI-prefixed, let's store that data in the unit registry. That means adding that data to the units in the default unit symbol lookup table. It also means adding the ability to add new SI-prefixed units to a unit registry. It was already possible to do that globally via define_unit, now it's possible to do it just for a single unit registry.

This makes it easier to use unyt as a library without messing with unyt's internals. It also eliminates one vector for cross-library interference by no longer having as much global state.

I found this while porting yt.units to use unyt under the hood.

@ngoldbaum ngoldbaum requested a review from jzuhone June 20, 2018 20:12
@ngoldbaum ngoldbaum merged commit 09e04b8 into yt-project:master Jun 21, 2018
@ngoldbaum ngoldbaum deleted the prefix-units branch December 14, 2018 19:12
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