MCPcopy Create free account
hub / github.com/NCAR/wrf-python / wetbulb

Function wetbulb

src/wrf/computation.py:1728–1782  ·  view source on GitHub ↗

Return the wetbulb temperature. This is the raw computational algorithm and does not extract any variables from WRF output files. Use :meth:`wrf.getvar` to both extract and compute diagnostic variables. Args: pres (:class:`xarray.DataArray` or :class:`numpy.ndarray`): Ful

(pres, tkel, qv, meta=True, units="K")

Source from the content-addressed store, hash-verified

1726 description="wetbulb temperature")
1727@convert_units("temp", "k")
1728def wetbulb(pres, tkel, qv, meta=True, units="K"):
1729 """Return the wetbulb temperature.
1730
1731 This is the raw computational algorithm and does not extract any variables
1732 from WRF output files. Use :meth:`wrf.getvar` to both extract and compute
1733 diagnostic variables.
1734
1735 Args:
1736
1737 pres (:class:`xarray.DataArray` or :class:`numpy.ndarray`): Full
1738 pressure (perturbation + base state pressure) in [Pa], with the
1739 rightmost dimensions as bottom_top x south_north x west_east
1740
1741 Note:
1742
1743 This variable must be
1744 supplied as a :class:`xarray.DataArray` in order to copy the
1745 dimension names to the output. Otherwise, default names will
1746 be used.
1747
1748 tkel (:class:`xarray.DataArray` or :class:`numpy.ndarray`): Temperature
1749 in [K] with same dimensionality as *pres*.
1750
1751 qv (:class:`xarray.DataArray` or :class:`numpy.ndarray`): Water vapor
1752 mixing ratio in [kg/kg] with the same dimensionality as
1753 *pres*
1754
1755 meta (:obj:`bool`): Set to False to disable metadata and return
1756 :class:`numpy.ndarray` instead of
1757 :class:`xarray.DataArray`. Default is True.
1758
1759 units (:obj:`str`): The desired units. Refer to the :meth:`getvar`
1760 product table for a list of available units for 'twb'. Default
1761 is 'K'.
1762
1763 Warning:
1764
1765 The input arrays must not contain any missing/fill values or
1766 :data:`numpy.nan` values.
1767
1768 Returns:
1769
1770 :class:`xarray.DataArray` or :class:`numpy.ndarray`: The
1771 wetbulb temperature. If xarray is enabled and
1772 the *meta* parameter is True, then the result will be an
1773 :class:`xarray.DataArray` object. Otherwise, the result will
1774 be a :class:`numpy.ndarray` object with no metadata.
1775
1776 See Also:
1777
1778 :meth:`wrf.getvar`, :meth:`wrf.temp`, :meth:`wrf.eth`,
1779 :meth:`tvirtual`
1780
1781 """
1782 return _wetbulb(pres, tkel, qv)
1783
1784
1785@set_alg_metadata(3, "tkel",

Callers

nothing calls this directly

Calls 1

_wetbulbFunction · 0.85

Tested by

no test coverage detected