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

Function get_tv

src/wrf/g_temp.py:242–317  ·  view source on GitHub ↗

Return the virtual temperature. 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 :cl

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

Source from the content-addressed store, hash-verified

240 description="virtual temperature")
241@convert_units("temp", "k")
242def get_tv(wrfin, timeidx=0, method="cat", squeeze=True,
243 cache=None, meta=True, _key=None,
244 units="K"):
245 """Return the virtual temperature.
246
247 This functions extracts the necessary variables from the NetCDF file
248 object in order to perform the calculation.
249
250 Args:
251
252 wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
253 iterable): WRF-ARW NetCDF
254 data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
255 or an iterable sequence of the aforementioned types.
256
257 timeidx (:obj:`int` or :data:`wrf.ALL_TIMES`, optional): The
258 desired time index. This value can be a positive integer,
259 negative integer, or
260 :data:`wrf.ALL_TIMES` (an alias for None) to return
261 all times in the file or sequence. The default is 0.
262
263 method (:obj:`str`, optional): The aggregation method to use for
264 sequences. Must be either 'cat' or 'join'.
265 'cat' combines the data along the Time dimension.
266 'join' creates a new dimension for the file index.
267 The default is 'cat'.
268
269 squeeze (:obj:`bool`, optional): Set to False to prevent dimensions
270 with a size of 1 from being automatically removed from the shape
271 of the output. Default is True.
272
273 cache (:obj:`dict`, optional): A dictionary of (varname, ndarray)
274 that can be used to supply pre-extracted NetCDF variables to the
275 computational routines. It is primarily used for internal
276 purposes, but can also be used to improve performance by
277 eliminating the need to repeatedly extract the same variables
278 used in multiple diagnostics calculations, particularly when using
279 large sequences of files.
280 Default is None.
281
282 meta (:obj:`bool`, optional): Set to False to disable metadata and
283 return :class:`numpy.ndarray` instead of
284 :class:`xarray.DataArray`. Default is True.
285
286 _key (:obj:`int`, optional): A caching key. This is used for internal
287 purposes only. Default is None.
288
289 units (:obj:`str`): The desired units. Refer to the :meth:`getvar`
290 product table for a list of available units for 'tv'. Default
291 is 'K'.
292
293 Returns:
294 :class:`xarray.DataArray` or :class:`numpy.ndarray`: The
295 virtual temperature.
296 If xarray is enabled and the *meta* parameter is True, then the result
297 will be a :class:`xarray.DataArray` object. Otherwise, the result will
298 be a :class:`numpy.ndarray` object with no metadata.
299

Callers

nothing calls this directly

Calls 3

extract_varsFunction · 0.85
_tkFunction · 0.85
_tvFunction · 0.85

Tested by

no test coverage detected