wrf.vinterp

wrf.vinterp(wrfin, field, vert_coord, interp_levels, extrapolate=False, field_type=None, log_p=False, timeidx=0, method='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) – 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. Values must be in the same units as specified above for the vert_coord parameter.

  • extrapolate (bool, optional) – Set to True to extrapolate values below ground. This is only performed when vert_coord is a pressure or height type, and the field_type is a pressure type (with height vertical coordinate), a height type (with pressure as the vertical coordinate), or a temperature type (with either height or pressure as the vertical coordinate). If those conditions are not met, or field_type is None, then the lowest model level will be used. Extrapolation is performed using standard atmosphere. Default is False.

  • field_type (str, optional) –

    The type of field. Default is None.

    Valid strings are:
    • ’none’: None

    • ’pressure’, ‘pres’, ‘p’: pressure [Pa]

    • ’pressure_hpa’, ‘pres_hpa’, ‘p_hpa’: pressure [hPa]

    • ’z’, ‘ght’: geopotential height [m]

    • ’z_km’, ‘ght_km’: geopotential height [km]

    • ’tc’: temperature [degC]

    • ’tk’: temperature [K]

    • ’theta’, ‘th’: potential temperature [K]

    • ’theta-e’, ‘thetae’, ‘eth’: equivalent potential temperature

  • log_p (bool, optional) – Set to True to use the log of the vertical coordinate for interpolation. This is mainly intended for pressure vertical coordinate types, but note that the log will still be taken for any vertical coordinate type when this is set to True. 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