We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
%
I'm trying to use the new % unit introduced in #1661.
While it works to define a quantity, that can then be converted to another dimensionless unit:
>>> ureg.Quantity(1, "%") <Quantity(1, 'percent')> >>> ureg.Quantity(1, "%").m_as("") 0.01
it doesn't seem to work the other way around.
>>> ureg.Quantity(1, "") <Quantity(1, 'dimensionless')> >>> ureg.Quantity(1, "").m_as("%") pint.errors.DefinitionSyntaxError: missing unary operator "%"
Is this a known limitation? It doesn't seem consistent.
Looks like preprocessors apply to quantity definitions but not unit expressions in Quantity.to.
Quantity.to
I think I have a workaround that at least solves my use case:
>>> ureg.Quantity(1, "").m_as(ureg.Unit("%")) 100.0
Perhaps this cast could be done somewhere in m_as, to or further down the way.
m_as
to
The text was updated successfully, but these errors were encountered:
confirmed
Sorry, something went wrong.
I think this can be closed with 0.23, no? I tried ureg.Quantity(1,'').to('%') and it works now.
Indeed, this seems to be fixed in 0.23.0.
Thanks.
No branches or pull requests
I'm trying to use the new
%
unit introduced in #1661.While it works to define a quantity, that can then be converted to another dimensionless unit:
it doesn't seem to work the other way around.
Is this a known limitation? It doesn't seem consistent.
Looks like preprocessors apply to quantity definitions but not unit expressions in
Quantity.to
.I think I have a workaround that at least solves my use case:
Perhaps this cast could be done somewhere in
m_as
,to
or further down the way.The text was updated successfully, but these errors were encountered: