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

Function get_tw

src/wrf/g_temp.py:323–397  ·  view source on GitHub ↗

Return the wetbulb 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

321 description="wetbulb temperature")
322@convert_units("temp", "k")
323def get_tw(wrfin, timeidx=0, method="cat", squeeze=True,
324 cache=None, meta=True, _key=None,
325 units="K"):
326 """Return the wetbulb temperature.
327
328 This functions extracts the necessary variables from the NetCDF file
329 object in order to perform the calculation.
330
331 Args:
332
333 wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
334 iterable): WRF-ARW NetCDF
335 data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
336 or an iterable sequence of the aforementioned types.
337
338 timeidx (:obj:`int` or :data:`wrf.ALL_TIMES`, optional): The
339 desired time index. This value can be a positive integer,
340 negative integer, or
341 :data:`wrf.ALL_TIMES` (an alias for None) to return
342 all times in the file or sequence. The default is 0.
343
344 method (:obj:`str`, optional): The aggregation method to use for
345 sequences. Must be either 'cat' or 'join'.
346 'cat' combines the data along the Time dimension.
347 'join' creates a new dimension for the file index.
348 The default is 'cat'.
349
350 squeeze (:obj:`bool`, optional): Set to False to prevent dimensions
351 with a size of 1 from being automatically removed from the shape
352 of the output. Default is True.
353
354 cache (:obj:`dict`, optional): A dictionary of (varname, ndarray)
355 that can be used to supply pre-extracted NetCDF variables to the
356 computational routines. It is primarily used for internal
357 purposes, but can also be used to improve performance by
358 eliminating the need to repeatedly extract the same variables
359 used in multiple diagnostics calculations, particularly when using
360 large sequences of files.
361 Default is None.
362
363 meta (:obj:`bool`, optional): Set to False to disable metadata and
364 return :class:`numpy.ndarray` instead of
365 :class:`xarray.DataArray`. Default is True.
366
367 _key (:obj:`int`, optional): A caching key. This is used for internal
368 purposes only. Default is None.
369
370 units (:obj:`str`): The desired units. Refer to the :meth:`getvar`
371 product table for a list of available units for 'twb'. Default
372 is 'K'.
373
374 Returns:
375 :class:`xarray.DataArray` or :class:`numpy.ndarray`: The
376 wetbulb temperature.
377 If xarray is enabled and the *meta* parameter is True, then the result
378 will be a :class:`xarray.DataArray` object. Otherwise, the result will
379 be a :class:`numpy.ndarray` object with no metadata.
380

Callers

nothing calls this directly

Calls 3

extract_varsFunction · 0.85
_tkFunction · 0.85
_wetbulbFunction · 0.85

Tested by

no test coverage detected