wrf.interpz3d¶
-
wrf.interpz3d(field3d, vert, desiredlev, missing=9.969209968386869e+36, meta=True)¶ Return the field interpolated to a specified pressure or height level.
This function is roughly equivalent to
interplevel(), but does not handle multi-product diagnostics (uvmet, cape_3d, etc) that contain an additional leftmost dimension for the product type. Also, anumpy.ma.MaskedArrayis not created and this routine should be considered as low-level access to the underlying Fortran routine.See also
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.
Warning
The input arrays must not contain any missing/fill values or
numpy.nanvalues.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: xarray.DataArrayornumpy.ndarrayExample
Example 1: Interpolate Geopotential Height to 500 hPa
from netCDF4 import Dataset from wrf import getvar, interpz3d wrfin = Dataset("wrfout_d02_2010-06-13_21:00:00") p = getvar(wrfin, "pressure") ht = getvar(wrfin, "z", units="dm") ht_500 = interpz3d(ht, p, 500.0)
- field3d (