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

Function get_lfc

src/wrf/g_cape.py:430–494  ·  view source on GitHub ↗

Return the two-dimensional field of LFC (Level of Free Convection). 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-

(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

428
429
430def get_lfc(wrfin, timeidx=0, method="cat", squeeze=True, cache=None,
431 meta=True, _key=None, missing=default_fill(np.float64)):
432 """Return the two-dimensional field of LFC (Level of Free Convection).
433
434 This functions extracts the necessary variables from the NetCDF file
435 object in order to perform the calculation.
436
437 Args:
438
439 wrfin (:class:`netCDF4.Dataset`, :class:`Nio.NioFile`, or an \
440 iterable): WRF-ARW NetCDF
441 data as a :class:`netCDF4.Dataset`, :class:`Nio.NioFile`
442 or an iterable sequence of the aforementioned types.
443
444 timeidx (:obj:`int` or :data:`wrf.ALL_TIMES`, optional): The
445 desired time index. This value can be a positive integer,
446 negative integer, or
447 :data:`wrf.ALL_TIMES` (an alias for None) to return
448 all times in the file or sequence. The default is 0.
449
450 method (:obj:`str`, optional): The aggregation method to use for
451 sequences. Must be either 'cat' or 'join'.
452 'cat' combines the data along the Time dimension.
453 'join' creates a new dimension for the file index.
454 The default is 'cat'.
455
456 squeeze (:obj:`bool`, optional): Set to False to prevent dimensions
457 with a size of 1 from being automatically removed from the shape
458 of the output. Default is True.
459
460 cache (:obj:`dict`, optional): A dictionary of (varname, ndarray)
461 that can be used to supply pre-extracted NetCDF variables to the
462 computational routines. It is primarily used for internal
463 purposes, but can also be used to improve performance by
464 eliminating the need to repeatedly extract the same variables
465 used in multiple diagnostics calculations, particularly when using
466 large sequences of files.
467 Default is None.
468
469 meta (:obj:`bool`, optional): Set to False to disable metadata and
470 return :class:`numpy.ndarray` instead of
471 :class:`xarray.DataArray`. Default is True.
472
473 _key (:obj:`int`, optional): A caching key. This is used for internal
474 purposes only. Default is None.
475
476 missing (:obj:`float`): The fill value to use for the output.
477 Default is :data:`wrf.default_fill(np.float64)`.
478
479 Returns:
480 :class:`xarray.DataArray` or :class:`numpy.ndarray`: The
481 2D LFC field.
482 If xarray is enabled and the *meta* parameter is True, then the result
483 will be a :class:`xarray.DataArray` object. Otherwise, the result will
484 be a :class:`numpy.ndarray` object with no metadata.
485
486 """
487 result = get_2dcape(wrfin, timeidx, method, squeeze, cache,

Callers

nothing calls this directly

Calls 2

default_fillFunction · 0.85
get_2dcapeFunction · 0.85

Tested by

no test coverage detected