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

Function interpz3d

src/wrf/computation.py:254–319  ·  view source on GitHub ↗

Return the field interpolated to a specified pressure or height level. This function is roughly equivalent to :meth:`interplevel`, but does not handle multi-product diagnostics (uvmet, cape_3d, etc) that contain an additional leftmost dimension for the product type. Also, a :class:

(field3d, vert, desiredlev, missing=default_fill(np.float64),
              meta=True)

Source from the content-addressed store, hash-verified

252
253@set_interp_metadata("horiz")
254def interpz3d(field3d, vert, desiredlev, missing=default_fill(np.float64),
255 meta=True):
256 """Return the field interpolated to a specified pressure or height level.
257
258 This function is roughly equivalent to :meth:`interplevel`, but does not
259 handle multi-product diagnostics (uvmet, cape_3d, etc) that contain an
260 additional leftmost dimension for the product type. Also, a
261 :class:`numpy.ma.MaskedArray` is not created and this routine should
262 be considered as low-level access to the underlying Fortran routine.
263
264 See Also:
265
266 :meth:`wrf.interplevel`
267
268 Args:
269
270 field3d (:class:`xarray.DataArray` or :class:`numpy.ndarray`): A
271 three-dimensional field to interpolate, with the rightmost
272 dimensions of nz x ny x nx.
273
274 vert (:class:`xarray.DataArray` or :class:`numpy.ndarray`): A
275 three-dimensional array for the vertical coordinate, typically
276 pressure or height. This array must have the same dimensionality
277 as *field3d*.
278
279 desiredlev (:obj:`float`): The desired vertical level.
280 Must be in the same units as the *vert* parameter.
281
282 missing (:obj:`float`): The fill value to use for the output.
283 Default is :data:`wrf.default_fill(numpy.float64)`.
284
285 meta (:obj:`bool`): Set to False to disable metadata and return
286 :class:`numpy.ndarray` instead of
287 :class:`xarray.DataArray`. Default is True.
288
289 Warning:
290
291 The input arrays must not contain any missing/fill values or
292 :data:`numpy.nan` values.
293
294 Returns:
295
296 :class:`xarray.DataArray` or :class:`numpy.ndarray`: The
297 interpolated variable. If xarray is enabled and
298 the *meta* parameter is True, then the result will be an
299 :class:`xarray.DataArray` object. Otherwise, the result will
300 be a :class:`numpy.ndarray` object with no metadata.
301
302 Example:
303
304 Example 1: Interpolate Geopotential Height to 500 hPa
305
306 .. code-block:: python
307
308 from netCDF4 import Dataset
309 from wrf import getvar, interpz3d
310
311 wrfin = Dataset("wrfout_d02_2010-06-13_21:00:00")

Callers

nothing calls this directly

Calls 2

default_fillFunction · 0.85
_interpz3dFunction · 0.85

Tested by

no test coverage detected