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

API Mistake Found -> .to_preferred() #2067

Open
gaokeyan123 opened this issue Oct 23, 2024 · 1 comment
Open

API Mistake Found -> .to_preferred() #2067

gaokeyan123 opened this issue Oct 23, 2024 · 1 comment

Comments

@gaokeyan123
Copy link

if you run this,

a = 0 * UReg.kilogram / UReg.meter ** 3 / UReg.second
print(a.to_preferred([UReg.hour]))

it gives error:

pint.errors.DimensionalityError: Cannot convert from 'kilogram / meter ** 3 / second' ([mass] / [length] ** 3 / [time]) to 'kilogram ** 1 / hour / meter ** 3' ([mass] ** 1 / [time] / [length] ** 3)

@andrewgsavage
Copy link
Collaborator

andrewgsavage commented Nov 9, 2024

you also need to provide a mass and distance unit

we could change it so the units in the original quantity are used when there aren't any units of a dimension

e: ah maybe I've misunderstood this as it looks like it tried to do what I suggested. is it beacuse it's a 0 magnitude quantity?

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

No branches or pull requests

2 participants