wrf.vinterp

wrf.vinterp(wrfin, field, vert_coord, interp_levels, extrapolate=False, field_type=None, log_p=False, timeidx=0, method=u'cat', squeeze=True, cache=None, meta=True)

Return the field vertically interpolated to the given the type of surface and a set of new levels.

Parameters:
  • wrfin (netCDF4.Dataset, Nio.NioFile, or an iterable) – Input WRF ARW NetCDF data as a netCDF4.Dataset, Nio.NioFile or an iterable sequence of the aforementioned types.
  • field (xarray.DataArray or numpy.ndarray) – A three-dimensional field.
  • vert_coord (str) –

    A string indicating the vertical coordinate type to interpolate to.

    Valid strings are:
    • ‘pressure’, ‘pres’, ‘p’: pressure [hPa]
    • ‘ght_msl’: grid point height msl [km]
    • ‘ght_agl’: grid point height agl [km]
    • ‘theta’, ‘th’: potential temperature [K]
    • ‘theta-e’, ‘thetae’, ‘eth’: equivalent potential temperature [K]
  • interp_levels (sequence) – A 1D sequence of vertical levels to interpolate to.
  • extrapolate (bool, optional) – Set to True to extrapolate values below ground. Default is False.
  • field_type (str, optional) –

    The type of field. Default is None.

    Valid strings are:
    • ‘none’: None
    • ‘pressure’, ‘pres’, ‘p’: pressure
    • ‘z’, ‘ght’: geopotential height
    • ‘tc’: temperature [degC]
    • ‘tk’: temperature [K]
    • ‘theta’, ‘th’: potential temperature [K]
    • ‘theta-e’, ‘thetae’, ‘eth’: equivalent potential temperature
  • log_p (bool, optional) – Use the log of the pressure for interpolation instead of pressure. Default is False.
  • timeidx (int, optional) – The time index to use when extracting auxiallary variables used in the interpolation. This value must be set to match the same value used when the field variable was extracted. Default is 0.
  • method (str, optional) – The aggregation method to use for sequences. Must be either ‘cat’ or ‘join’. ‘cat’ combines the data along the Time dimension. ‘join’ creates a new dimension for the file index. The default is ‘cat’.
  • squeeze (bool, optional) – Set to False to prevent dimensions with a size of 1 from being automatically removed from the shape of the output. Default is True.
  • cache (dict, optional) – A dictionary of (varname, ndarray) that can be used to supply pre-extracted NetCDF variables to the computational routines. It is primarily used for internal purposes, but can also be used to improve performance by eliminating the need to repeatedly extract the same variables used in multiple diagnostics calculations, particularly when using large sequences of files. Default is None.
  • meta (bool, optional) – Set to False to disable metadata and return numpy.ndarray instead of xarray.DataArray. Default is True.
Returns:

The interpolated variable. If xarray is enabled and the meta parameter is True, then the result will be a xarray.DataArray object. Otherwise, the result will be a numpy.ndarray object with no metadata.

Return type:

xarray.DataArray or numpy.ndarray