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

Function get_tc

src/wrf/g_temp.py:458–513  ·  view source on GitHub ↗

Return the temperature in [degC]. 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 :

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

Source from the content-addressed store, hash-verified

456
457
458def get_tc(wrfin, timeidx=0, method="cat", squeeze=True, cache=None,
459 meta=True, _key=None):
460 """Return the temperature in [degC].
461
462 This functions extracts the necessary variables from the NetCDF file
463 object in order to perform the calculation.
464
465 Args:
466
467 wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
468 iterable): WRF-ARW NetCDF
469 data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
470 or an iterable sequence of the aforementioned types.
471
472 timeidx (:obj:`int` or :data:`wrf.ALL_TIMES`, optional): The
473 desired time index. This value can be a positive integer,
474 negative integer, or
475 :data:`wrf.ALL_TIMES` (an alias for None) to return
476 all times in the file or sequence. The default is 0.
477
478 method (:obj:`str`, optional): The aggregation method to use for
479 sequences. Must be either 'cat' or 'join'.
480 'cat' combines the data along the Time dimension.
481 'join' creates a new dimension for the file index.
482 The default is 'cat'.
483
484 squeeze (:obj:`bool`, optional): Set to False to prevent dimensions
485 with a size of 1 from being automatically removed from the shape
486 of the output. Default is True.
487
488 cache (:obj:`dict`, optional): A dictionary of (varname, ndarray)
489 that can be used to supply pre-extracted NetCDF variables to the
490 computational routines. It is primarily used for internal
491 purposes, but can also be used to improve performance by
492 eliminating the need to repeatedly extract the same variables
493 used in multiple diagnostics calculations, particularly when using
494 large sequences of files.
495 Default is None.
496
497 meta (:obj:`bool`, optional): Set to False to disable metadata and
498 return :class:`numpy.ndarray` instead of
499 :class:`xarray.DataArray`. Default is True.
500
501 _key (:obj:`int`, optional): A caching key. This is used for internal
502 purposes only. Default is None.
503
504 Returns:
505 :class:`xarray.DataArray` or :class:`numpy.ndarray`: The
506 temperature in [degC].
507 If xarray is enabled and the *meta* parameter is True, then the result
508 will be a :class:`xarray.DataArray` object. Otherwise, the result will
509 be a :class:`numpy.ndarray` object with no metadata.
510
511 """
512 return get_temp(wrfin, timeidx, method, squeeze, cache, meta, _key,
513 units="degC")

Callers

nothing calls this directly

Calls 1

get_tempFunction · 0.85

Tested by

no test coverage detected