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

Feature request: option to disable units canceling? #1364

Closed
emlys opened this issue Aug 4, 2021 · 2 comments
Closed

Feature request: option to disable units canceling? #1364

emlys opened this issue Aug 4, 2021 · 2 comments

Comments

@emlys
Copy link

emlys commented Aug 4, 2021

Hello,
In some situations, units should not cancel out in division. For example, soil erodibility is measured in t * ha * hr / (ha * MJ * mm). By convention the hectares are left on the top and bottom, to emphasize that it measures soil loss (in t) per unit area (in ha) per unit of storm erosivity (in MJ * mm / (ha * hr)).

The option to instantiate a pint.Unit that evaluates without canceling would be useful in this situation. Something like:

>>> non_canceling_unit = pint.Unit('t * ha * hr / (ha * MJ * mm)', cancel=False)
>>> print(non_canceling_unit)
hectare * hour * metric_ton / hectare / megajoule / millimeter
@MichaelTiemannOSC
Copy link
Collaborator

MichaelTiemannOSC commented Sep 29, 2022

I would love to make tons of things non-cancellable. When computing emissions intensity, it would be great if t CO2 / t Steel did not cancel to CO2 / Steel. PLEASE!

I'm more than OK when t CO2 / t CO2 becomes dimensionless. It's just when substances are different I don't want the mass unit to disappear.

@hgrecco
Copy link
Owner

hgrecco commented Sep 29, 2022

Please take a look at #551 I would love to merge something in this direction, if someone wants to generate a PR

@hgrecco hgrecco closed this as completed Sep 29, 2022
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

3 participants