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

Function pw

src/wrf/computation.py:1903–1957  ·  view source on GitHub ↗

Return the precipitable water. 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`): Full

(pres, tkel, qv, height, meta=True)

Source from the content-addressed store, hash-verified

1901@set_alg_metadata(2, "pres", refvarndims=3, units="kg m-2",
1902 description="precipitable water")
1903def pw(pres, tkel, qv, height, meta=True):
1904 """Return the precipitable water.
1905
1906 This is the raw computational algorithm and does not extract any variables
1907 from WRF output files. Use :meth:`wrf.getvar` to both extract and compute
1908 diagnostic variables.
1909
1910 Args:
1911
1912 pres (:class:`xarray.DataArray` or :class:`numpy.ndarray`): Full
1913 pressure (perturbation + base state pressure) in [Pa], with the
1914 rightmost dimensions as bottom_top x south_north x west_east
1915
1916 Note:
1917
1918 This variable must be
1919 supplied as a :class:`xarray.DataArray` in order to copy the
1920 dimension names to the output. Otherwise, default names will
1921 be used.
1922
1923 tkel (:class:`xarray.DataArray` or :class:`numpy.ndarray`): Temperature
1924 in [K] with the same dimensionality as *pres*.
1925
1926 qv (:class:`xarray.DataArray` or :class:`numpy.ndarray`): Water vapor
1927 mixing ratio in [kg/kg] with the same dimensionality as *pres*
1928
1929 height (:class:`xarray.DataArray` or :class:`numpy.ndarray`):
1930 Geopotential height in [m] with the same dimensionality as
1931 *pres*.
1932
1933 meta (:obj:`bool`): Set to False to disable metadata and return
1934 :class:`numpy.ndarray` instead of
1935 :class:`xarray.DataArray`. Default is True.
1936
1937 Warning:
1938
1939 The input arrays must not contain any missing/fill values or
1940 :data:`numpy.nan` values.
1941
1942 Returns:
1943
1944 :class:`xarray.DataArray` or :class:`numpy.ndarray`: The precipitable
1945 water [kg m-2]. If xarray is enabled and
1946 the *meta* parameter is True, then the result will be an
1947 :class:`xarray.DataArray` object. Otherwise, the result will
1948 be a :class:`numpy.ndarray` object with no metadata.
1949
1950 See Also:
1951
1952 :meth:`wrf.getvar`
1953
1954 """
1955 tv = _tv(tkel, qv)
1956
1957 return _pw(pres, tv, qv, height)

Callers

nothing calls this directly

Calls 2

_tvFunction · 0.85
_pwFunction · 0.85

Tested by

no test coverage detected