I am working with Pint to do unit conversions in a Python project. The project involves temperature gradients, which are not defined in Pint. My units are typically “deg.C/km” so I’d like to be able to declare a Quantity as “55 deg.C/km”. I’d then like to use Pint to painlessly convert that Quantity to “XXX deg.F/mile” or “YYY deg.F/km” etc.
Tag: pint
Format Pint unit as short-form symbol
Say I have an arbitrary Pint quantity q. Is there a way to display its units in symbol short form, instead of as a full-length word? In other words, how would I code unit_symbol() such that it returns “m”, not “meter”; “kg” not “kilogram”; etc.? Is there a way to retrieve the short-form unit symbol that is synonym with the