wrf.interplevel¶
-
wrf.interplevel(field3d, vert, desiredlev, missing=9.969209968386869e+36, meta=True)¶ Return the three-dimensional field horizontally interpolated to a specified vertical level.
Parameters: - field3d (
xarray.DataArrayornumpy.ndarray) – A three-dimensional field to interpolate, with the rightmost dimensions of nz x ny x nx. - vert (
xarray.DataArrayornumpy.ndarray) – A three-dimensional array for the vertical coordinate, typically pressure or height. This array must have the same dimensionality as field3d. - desiredlev (
float) – The desired vertical level. Must be in the same units as the vert parameter. - missing (
float) – The fill value to use for the output. Default iswrf.Constants.DEFAULT_FILL. - meta (
bool) – Set to False to disable metadata and returnnumpy.ndarrayinstead ofxarray.DataArray. Default is True.
Returns: The interpolated variable. If xarray is enabled and the meta parameter is True, then the result will be an
xarray.DataArrayobject. Otherwise, the result will be anumpy.ndarrayobject with no metadata.Return type: Example
Interpolate Geopotential Height to 500 hPa
from netCDF4 import Dataset from wrf import getvar, interplevel wrfin = Dataset("wrfout_d02_2010-06-13_21:00:00") p = getvar(wrfin, "pressure") ht = getvar(wrfin, "z", units="dm") ht_500 = interplevel(ht, p, 500.0)
- field3d (