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

Function tk

src/wrf/computation.py:385–437  ·  view source on GitHub ↗

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

(pres, theta, meta=True, units="K")

Source from the content-addressed store, hash-verified

383@set_alg_metadata(3, "pres", description="temperature")
384@convert_units("temp", "k")
385def tk(pres, theta, meta=True, units="K"):
386 """Return the temperature.
387
388 This is the raw computational algorithm and does not extract any variables
389 from WRF output files. Use :meth:`wrf.getvar` to both extract and compute
390 diagnostic variables.
391
392 Args:
393
394 pres (:class:`xarray.DataArray` or :class:`numpy.ndarray`): Full
395 pressure (perturbation + base state pressure) in [Pa] with at least
396 three dimensions. The rightmost dimensions are bottom_top x
397 south_north x west_east.
398
399 Note:
400
401 This variable must be
402 supplied as a :class:`xarray.DataArray` in order to copy the
403 dimension names to the output. Otherwise, default names will
404 be used.
405
406 theta (:class:`xarray.DataArray` or :class:`numpy.ndarray`): Potential
407 temperature (perturbation plus reference temperature) in [K] with
408 the same dimensionality as *pres*.
409
410 meta (:obj:`bool`): Set to False to disable metadata and return
411 :class:`numpy.ndarray` instead of
412 :class:`xarray.DataArray`. Default is True.
413
414 units (:obj:`str`): The desired units. Refer to the :meth:`getvar`
415 product table for a list of available units for 'temp'. Default
416 is 'K'.
417
418 Warning:
419
420 The input arrays must not contain any missing/fill values or
421 :data:`numpy.nan` values.
422
423 Returns:
424
425 :class:`xarray.DataArray` or :class:`numpy.ndarray`: The
426 temperature in the specified units. If xarray is enabled and
427 the *meta* parameter is True, then the result will be an
428 :class:`xarray.DataArray` object. Otherwise, the result will
429 be a :class:`numpy.ndarray` object with no metadata.
430
431 See Also:
432
433 :meth:`wrf.getvar`, :meth:`wrf.tk`
434
435 """
436
437 return _tk(pres, theta)
438
439
440@set_alg_metadata(3, "pres", description="dew point temperature")

Callers 2

get_argsFunction · 0.85
funcFunction · 0.85

Calls 1

_tkFunction · 0.85

Tested by 2

get_argsFunction · 0.68
funcFunction · 0.68