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

Function get_theta

src/wrf/g_temp.py:13–79  ·  view source on GitHub ↗

Return the potential 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 :

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

Source from the content-addressed store, hash-verified

11 description="potential temperature")
12@convert_units("temp", "k")
13def get_theta(wrfin, timeidx=0, method="cat", squeeze=True,
14 cache=None, meta=True, _key=None,
15 units="K"):
16 """Return the potential temperature.
17
18 This functions extracts the necessary variables from the NetCDF file
19 object in order to perform the calculation.
20
21 Args:
22
23 wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
24 iterable): WRF-ARW NetCDF
25 data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
26 or an iterable sequence of the aforementioned types.
27
28 timeidx (:obj:`int` or :data:`wrf.ALL_TIMES`, optional): The
29 desired time index. This value can be a positive integer,
30 negative integer, or
31 :data:`wrf.ALL_TIMES` (an alias for None) to return
32 all times in the file or sequence. The default is 0.
33
34 method (:obj:`str`, optional): The aggregation method to use for
35 sequences. Must be either 'cat' or 'join'.
36 'cat' combines the data along the Time dimension.
37 'join' creates a new dimension for the file index.
38 The default is 'cat'.
39
40 squeeze (:obj:`bool`, optional): Set to False to prevent dimensions
41 with a size of 1 from being automatically removed from the shape
42 of the output. Default is True.
43
44 cache (:obj:`dict`, optional): A dictionary of (varname, ndarray)
45 that can be used to supply pre-extracted NetCDF variables to the
46 computational routines. It is primarily used for internal
47 purposes, but can also be used to improve performance by
48 eliminating the need to repeatedly extract the same variables
49 used in multiple diagnostics calculations, particularly when using
50 large sequences of files.
51 Default is None.
52
53 meta (:obj:`bool`, optional): Set to False to disable metadata and
54 return :class:`numpy.ndarray` instead of
55 :class:`xarray.DataArray`. Default is True.
56
57 _key (:obj:`int`, optional): A caching key. This is used for internal
58 purposes only. Default is None.
59
60 units (:obj:`str`): The desired units. Refer to the :meth:`getvar`
61 product table for a list of available units for 'theta'. Default
62 is 'K'.
63
64 Returns:
65 :class:`xarray.DataArray` or :class:`numpy.ndarray`: The
66 potential temperature.
67 If xarray is enabled and the *meta* parameter is True, then the result
68 will be a :class:`xarray.DataArray` object. Otherwise, the result will
69 be a :class:`numpy.ndarray` object with no metadata.
70

Callers 1

vinterpFunction · 0.90

Calls 1

extract_varsFunction · 0.85

Tested by

no test coverage detected