diff --git a/src/metpy/calc/thermo.py b/src/metpy/calc/thermo.py index edeb22d825..69ea80667f 100644 --- a/src/metpy/calc/thermo.py +++ b/src/metpy/calc/thermo.py @@ -31,7 +31,9 @@ @exporter.export @preprocess_and_wrap(wrap_like='specific_humidity') -@check_units('[dimensionless]') +@process_units(input_dimensionalities={'specific_humidity': 'dimensionless'}, + output_dimensionalities='[specific_heat_capacity]', + output_to='J kg**-1 K**-1') def moist_air_gas_constant(specific_humidity): r"""Calculate R_m, the specific gas constant for a parcel of moist air. @@ -68,7 +70,9 @@ def moist_air_gas_constant(specific_humidity): @exporter.export @preprocess_and_wrap(wrap_like='specific_humidity') -@check_units('[dimensionless]') +@process_units(input_dimensionalities={'specific_humidity': 'dimensionless'}, + output_dimensionalities='[specific_heat_capacity]', + output_to='J kg**-1 K**-1') def moist_air_specific_heat_pressure(specific_humidity): r"""Calculate C_pm, the specific heat at constant pressure for a moist air parcel. @@ -105,7 +109,9 @@ def moist_air_specific_heat_pressure(specific_humidity): @exporter.export @preprocess_and_wrap(wrap_like='temperature') -@check_units('[temperature]') +@process_units(input_dimensionalities={'temperature': '[temperature]'}, + output_dimensionalities='[specific_enthalpy]', + output_to='J kg**-1') def water_latent_heat_vaporization(temperature): r"""Calculate the latent heat of vaporization for water. @@ -140,14 +146,16 @@ def water_latent_heat_vaporization(temperature): Eq 15, [Ambaum2020]_, using MetPy-defined constants in place of cited values. """ - return (mpconsts.water_heat_vaporization - - (mpconsts.water_specific_heat - mpconsts.wv_specific_heat_press) - * (temperature - mpconsts.water_triple_point_temperature)) + return (mpconsts.nounit.Lv + - (mpconsts.nounit.Cp_l - mpconsts.nounit.Cp_v) + * (temperature - mpconsts.nounit.T0)) @exporter.export @preprocess_and_wrap(wrap_like='temperature') -@check_units('[temperature]') +@process_units(input_dimensionalities={'temperature': '[temperature]'}, + output_dimensionalities='[specific_enthalpy]', + output_to='J kg**-1') def water_latent_heat_sublimation(temperature): r"""Calculate the latent heat of sublimation for water. @@ -180,14 +188,16 @@ def water_latent_heat_sublimation(temperature): Eq 18, [Ambaum2020]_, using MetPy-defined constants in place of cited values. """ - return (mpconsts.water_heat_sublimation - - (mpconsts.ice_specific_heat - mpconsts.wv_specific_heat_press) - * (temperature - mpconsts.water_triple_point_temperature)) + return (mpconsts.nounit.Ls + - (mpconsts.nounit.Cp_i - mpconsts.nounit.Cp_v) + * (temperature - mpconsts.nounit.T0)) @exporter.export @preprocess_and_wrap(wrap_like='temperature') -@check_units('[temperature]') +@process_units(input_dimensionalities={'temperature': '[temperature]'}, + output_dimensionalities='[specific_enthalpy]', + output_to='J kg**-1') def water_latent_heat_melting(temperature): r"""Calculate the latent heat of melting for water. @@ -221,9 +231,9 @@ def water_latent_heat_melting(temperature): Uses MetPy-defined constants in place of cited values. """ - return (mpconsts.water_heat_fusion - - (mpconsts.water_specific_heat - mpconsts.ice_specific_heat) - * (temperature - mpconsts.water_triple_point_temperature)) + return (mpconsts.nounit.Lf + - (mpconsts.nounit.Cp_l - mpconsts.nounit.Cp_i) + * (temperature - mpconsts.nounit.T0)) @exporter.export @@ -1478,7 +1488,7 @@ def vapor_pressure(pressure, mixing_ratio): @exporter.export @preprocess_and_wrap(wrap_like='temperature') -@process_units({'temperature': '[temperature]'}, '[pressure]') +@process_units({'temperature': '[temperature]'},'[pressure]') def saturation_vapor_pressure(temperature): r"""Calculate the saturation water vapor (partial) pressure.