This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
Hello, and thanks for reaching out! Good catch! This documentation is incorrect. In our constants, we define R_v as R (in J / mol / K) divided by M_water (in g / mol), resulting in the value you received in J / g / K. We'll fix this to either document correctly, or update the definition of R_v to return J / kg / K. Either way, useful tools for you here are Pint's unit conversion methods, particularly `.to('<unit>')` (docs: https://pint.readthedocs.io/en/stable/tutorial.html#converting-to-different-units). So, for you here, Rv = mpcons.water_gas_constant.to('J / kg / K') which will do the appropriate multiplication and update your Quantity's unit string. This can also be found in MetPy's units tutorial (https://unidata.github.io/MetPy/latest/tutorials/unit_tutorial.html#converting-units). Thanks again for reaching out, and let me know if there's any further help we can provide! All the best, Drew > For the water_gas_constant, the documentation says that units are J/K/Kg > however: > > Rv=mpcons.water_gas_constant > > This returns: > >>> Rv > <Quantity(0.461523116, 'joule / gram / kelvin’)> > > Note the units are J/g/K. I would have expected it to return 461.52 J/kg/K > > Other constants (e.g. dry_air_gas_constant) are correct. How do I convert it > to J/kg/K? Obviously I can multiply by 1000 but that does nothing for the > units. > > The units documentation doesn’t cover a case like this. Ticket Details =================== Ticket ID: PPS-589228 Department: Support Python Priority: Low Status: Closed =================== NOTE: All email exchanges with Unidata User Support are recorded in the Unidata inquiry tracking system and then made publicly available through the web. If you do not want to have your interactions made available in this way, you must let us know in each email you send to us.