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

Function get_2dcape

src/wrf/g_cape.py:14–127  ·  view source on GitHub ↗

Return the two-dimensional fields of MCAPE, MCIN, LCL, and LFC. The leftmost dimension of the returned array represents four different quantities: - return_val[0,...] will contain MCAPE [J kg-1] - return_val[1,...] will contain MCIN [J kg-1] - return_val[2,...] will

(wrfin, timeidx=0, method="cat", squeeze=True, cache=None,
               meta=True, _key=None, missing=default_fill(np.float64))

Source from the content-addressed store, hash-verified

12
13@set_cape_metadata(is2d=True)
14def get_2dcape(wrfin, timeidx=0, method="cat", squeeze=True, cache=None,
15 meta=True, _key=None, missing=default_fill(np.float64)):
16 """Return the two-dimensional fields of MCAPE, MCIN, LCL, and LFC.
17
18 The leftmost dimension of the returned array represents four different
19 quantities:
20
21 - return_val[0,...] will contain MCAPE [J kg-1]
22 - return_val[1,...] will contain MCIN [J kg-1]
23 - return_val[2,...] will contain LCL [m]
24 - return_val[3,...] will contain LFC [m]
25
26 This functions extracts the necessary variables from the NetCDF file
27 object in order to perform the calculation.
28
29 Args:
30
31 wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
32 iterable): WRF-ARW NetCDF
33 data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
34 or an iterable sequence of the aforementioned types.
35
36 timeidx (:obj:`int` or :data:`wrf.ALL_TIMES`, optional): The
37 desired time index. This value can be a positive integer,
38 negative integer, or
39 :data:`wrf.ALL_TIMES` (an alias for None) to return
40 all times in the file or sequence. The default is 0.
41
42 method (:obj:`str`, optional): The aggregation method to use for
43 sequences. Must be either 'cat' or 'join'.
44 'cat' combines the data along the Time dimension.
45 'join' creates a new dimension for the file index.
46 The default is 'cat'.
47
48 squeeze (:obj:`bool`, optional): Set to False to prevent dimensions
49 with a size of 1 from being automatically removed from the shape
50 of the output. Default is True.
51
52 cache (:obj:`dict`, optional): A dictionary of (varname, ndarray)
53 that can be used to supply pre-extracted NetCDF variables to the
54 computational routines. It is primarily used for internal
55 purposes, but can also be used to improve performance by
56 eliminating the need to repeatedly extract the same variables
57 used in multiple diagnostics calculations, particularly when using
58 large sequences of files.
59 Default is None.
60
61 meta (:obj:`bool`, optional): Set to False to disable metadata and
62 return :class:`numpy.ndarray` instead of
63 :class:`xarray.DataArray`. Default is True.
64
65 _key (:obj:`int`, optional): A caching key. This is used for internal
66 purposes only. Default is None.
67
68 missing (:obj:`float`): The fill value to use for the output.
69 Default is :data:`wrf.default_fill(np.float64)`.
70
71 Returns:

Callers 4

get_cape2d_onlyFunction · 0.85
get_cin2d_onlyFunction · 0.85
get_lclFunction · 0.85
get_lfcFunction · 0.85

Calls 5

default_fillFunction · 0.85
extract_varsFunction · 0.85
_tkFunction · 0.85
destaggerFunction · 0.85
_capeFunction · 0.85

Tested by

no test coverage detected