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

Function get_tk

src/wrf/g_temp.py:400–455  ·  view source on GitHub ↗

Return the temperature in [K]. This functions extracts the necessary variables from the NetCDF file object in order to perform the calculation. Args: wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \ iterable): WRF-ARW NetCDF data as a :cla

(wrfin, timeidx=0, method="cat", squeeze=True, cache=None,
           meta=True, _key=None)

Source from the content-addressed store, hash-verified

398
399
400def get_tk(wrfin, timeidx=0, method="cat", squeeze=True, cache=None,
401 meta=True, _key=None):
402 """Return the temperature in [K].
403
404 This functions extracts the necessary variables from the NetCDF file
405 object in order to perform the calculation.
406
407 Args:
408
409 wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
410 iterable): WRF-ARW NetCDF
411 data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
412 or an iterable sequence of the aforementioned types.
413
414 timeidx (:obj:`int` or :data:`wrf.ALL_TIMES`, optional): The
415 desired time index. This value can be a positive integer,
416 negative integer, or
417 :data:`wrf.ALL_TIMES` (an alias for None) to return
418 all times in the file or sequence. The default is 0.
419
420 method (:obj:`str`, optional): The aggregation method to use for
421 sequences. Must be either 'cat' or 'join'.
422 'cat' combines the data along the Time dimension.
423 'join' creates a new dimension for the file index.
424 The default is 'cat'.
425
426 squeeze (:obj:`bool`, optional): Set to False to prevent dimensions
427 with a size of 1 from being automatically removed from the shape
428 of the output. Default is True.
429
430 cache (:obj:`dict`, optional): A dictionary of (varname, ndarray)
431 that can be used to supply pre-extracted NetCDF variables to the
432 computational routines. It is primarily used for internal
433 purposes, but can also be used to improve performance by
434 eliminating the need to repeatedly extract the same variables
435 used in multiple diagnostics calculations, particularly when using
436 large sequences of files.
437 Default is None.
438
439 meta (:obj:`bool`, optional): Set to False to disable metadata and
440 return :class:`numpy.ndarray` instead of
441 :class:`xarray.DataArray`. Default is True.
442
443 _key (:obj:`int`, optional): A caching key. This is used for internal
444 purposes only. Default is None.
445
446 Returns:
447 :class:`xarray.DataArray` or :class:`numpy.ndarray`: The
448 temperature in [K].
449 If xarray is enabled and the *meta* parameter is True, then the result
450 will be a :class:`xarray.DataArray` object. Otherwise, the result will
451 be a :class:`numpy.ndarray` object with no metadata.
452
453 """
454 return get_temp(wrfin, timeidx, method, squeeze, cache, meta, _key,
455 units="K")
456
457

Callers

nothing calls this directly

Calls 1

get_tempFunction · 0.85

Tested by

no test coverage detected