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

Function tvirtual

src/wrf/computation.py:1788–1839  ·  view source on GitHub ↗

Return the virtual 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: tkel (:class:`xarray.DataArray` or :class:`numpy.ndarray`): Tem

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

Source from the content-addressed store, hash-verified

1786 description="virtual temperature")
1787@convert_units("temp", "k")
1788def tvirtual(tkel, qv, meta=True, units="K"):
1789 """Return the virtual temperature.
1790
1791 This is the raw computational algorithm and does not extract any variables
1792 from WRF output files. Use :meth:`wrf.getvar` to both extract and compute
1793 diagnostic variables.
1794
1795 Args:
1796
1797 tkel (:class:`xarray.DataArray` or :class:`numpy.ndarray`): Temperature
1798 in [K] with the rightmost dimensions as bottom_top x south_north
1799 x west_east.
1800
1801 Note:
1802
1803 This variable must be
1804 supplied as a :class:`xarray.DataArray` in order to copy the
1805 dimension names to the output. Otherwise, default names will
1806 be used.
1807
1808 qv (:class:`xarray.DataArray` or :class:`numpy.ndarray`): Water vapor
1809 mixing ratio in [kg/kg] with the same dimensionality as
1810 *tkel*
1811
1812 meta (:obj:`bool`): Set to False to disable metadata and return
1813 :class:`numpy.ndarray` instead of
1814 :class:`xarray.DataArray`. Default is True.
1815
1816 units (:obj:`str`): The desired units. Refer to the :meth:`getvar`
1817 product table for a list of available units for 'tv'. Default
1818 is 'K'.
1819
1820 Warning:
1821
1822 The input arrays must not contain any missing/fill values or
1823 :data:`numpy.nan` values.
1824
1825 Returns:
1826
1827 :class:`xarray.DataArray` or :class:`numpy.ndarray`: The
1828 virtual temperature. If xarray is enabled and
1829 the *meta* parameter is True, then the result will be an
1830 :class:`xarray.DataArray` object. Otherwise, the result will
1831 be a :class:`numpy.ndarray` object with no metadata.
1832
1833 See Also:
1834
1835 :meth:`wrf.getvar`, :meth:`wrf.temp`, :meth:`wrf.eth`,
1836 :meth:`wetbulb`
1837
1838 """
1839 return _tv(tkel, qv)
1840
1841
1842@set_alg_metadata(3, "qv", units="Pa s-1",

Callers

nothing calls this directly

Calls 1

_tvFunction · 0.85

Tested by

no test coverage detected