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

Function get_3dcape

src/wrf/g_cape.py:131–225  ·  view source on GitHub ↗

Return the three-dimensional CAPE and CIN. The leftmost dimension of the returned array represents two different quantities: - return_val[0,...] will contain CAPE [J kg-1] - return_val[1,...] will contain CIN [J kg-1] This functions extracts the necessary variables fro

(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

129
130@set_cape_metadata(is2d=False)
131def get_3dcape(wrfin, timeidx=0, method="cat",
132 squeeze=True, cache=None, meta=True,
133 _key=None, missing=default_fill(np.float64)):
134 """Return the three-dimensional CAPE and CIN.
135
136 The leftmost dimension of the returned array represents two different
137 quantities:
138
139 - return_val[0,...] will contain CAPE [J kg-1]
140 - return_val[1,...] will contain CIN [J kg-1]
141
142 This functions extracts the necessary variables from the NetCDF file
143 object in order to perform the calculation.
144
145 Args:
146
147 wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
148 iterable): WRF-ARW NetCDF
149 data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
150 or an iterable sequence of the aforementioned types.
151
152 timeidx (:obj:`int` or :data:`wrf.ALL_TIMES`, optional): The
153 desired time index. This value can be a positive integer,
154 negative integer, or
155 :data:`wrf.ALL_TIMES` (an alias for None) to return
156 all times in the file or sequence. The default is 0.
157
158 method (:obj:`str`, optional): The aggregation method to use for
159 sequences. Must be either 'cat' or 'join'.
160 'cat' combines the data along the Time dimension.
161 'join' creates a new dimension for the file index.
162 The default is 'cat'.
163
164 squeeze (:obj:`bool`, optional): Set to False to prevent dimensions
165 with a size of 1 from being automatically removed from the shape
166 of the output. Default is True.
167
168 cache (:obj:`dict`, optional): A dictionary of (varname, ndarray)
169 that can be used to supply pre-extracted NetCDF variables to the
170 computational routines. It is primarily used for internal
171 purposes, but can also be used to improve performance by
172 eliminating the need to repeatedly extract the same variables
173 used in multiple diagnostics calculations, particularly when using
174 large sequences of files.
175 Default is None.
176
177 meta (:obj:`bool`, optional): Set to False to disable metadata and
178 return :class:`numpy.ndarray` instead of
179 :class:`xarray.DataArray`. Default is True.
180
181 _key (:obj:`int`, optional): A caching key. This is used for internal
182 purposes only. Default is None.
183
184 missing (:obj:`float`): The fill value to use for the output.
185 Default is :data:`wrf.default_fill(np.float64)`.
186
187 Returns:
188 :class:`xarray.DataArray` or :class:`numpy.ndarray`: The

Callers 2

get_3dcape_onlyFunction · 0.85
get_3dcin_onlyFunction · 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