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))
| 12 | |
| 13 | @set_cape_metadata(is2d=True) |
| 14 | def 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: |
no test coverage detected