Extract scalar value from pint.quantity #2926
-
How do I extract the numeric value or convert Pint.quantity to a scalar numeric value? from metpy.calc import virtual_temperature
from metpy.units import units
x = virtual_temperature(283 * units.K, 12 * units('g/kg'))
print(x)
<Quantity(285.039709, 'kelvin')> I would like to just get the numeric value of |
Beta Was this translation helpful? Give feedback.
Answered by
dopplershift
Feb 16, 2023
Replies: 1 comment 1 reply
-
From the user's guide->Unit Tutorial->"Dropping Units":
Or you can write that really succinctly as |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
dopplershift
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
From the user's guide->Unit Tutorial->"Dropping Units":
Or you can write that really succinctly as
x.m
.