geocat.comp.interpolation.interp_hybrid_to_pressure

geocat.comp.interpolation.interp_hybrid_to_pressure#

geocat.comp.interpolation.interp_hybrid_to_pressure(data, ps, hyam, hybm, p0=100000.0, new_levels=array([100000., 92500., 85000., 70000., 50000., 40000., 30000., 25000., 20000., 15000., 10000., 7000., 5000., 3000., 2000., 1000., 700., 500., 300., 200., 100.], dtype=float32), lev_dim=None, method='linear', extrapolate=False, variable=None, t_bot=None, phi_sfc=None)#

Interpolate and extrapolate data from hybrid-sigma levels to isobaric levels. Keeps attributes (i.e. metadata) of the input data in the output as default.

Notes

Atmosphere hybrid-sigma pressure coordinates are commonly defined in two different ways as described below and in CF Conventions. This particular function expects the first formulation. However, with some minor adjustments on the user side it can support datasets leveraging the second formulation as well. In this case, you can set the input parameters p0=1 and hyam=ap to adapt the function to meet your needs.

Formulation 1: p(n,k,j,i) = a(k)*p0 + b(k)*ps(n,j,i) Formulation 2: p(n,k,j,i) = ap(k) + b(k)*ps(n,j,i)

ACKNOWLEDGEMENT: We’d like to thank to Brian Medeiros, Matthew Long, and Deepak Cherian at NSF NCAR for their great contributions since the code implemented here is mostly based on their work.

Parameters:
  • data (xarray.DataArray) – Multidimensional data array of hybrid-sigma levels and has a lev_dim coordinate.

  • ps (xarray.DataArray) – A multi-dimensional array of surface pressures (Pa), same time/space shape as data.

  • hyam, hybm (xarray.DataArray) – One-dimensional arrays containing the hybrid A and B coefficients. Must have the same dimension size as the lev_dim dimension of data.

  • p0 (float, optional) – Scalar numeric value equal to surface reference pressure (Pa). Defaults to 100000 Pa.

  • new_levels (numpy.ndarray, optional) – A one-dimensional array of output pressure levels (Pa). If not given, the mandatory list of 21 pressure levels is used.

  • lev_dim (str, optional) – String that is the name of level dimension in data. Defaults to “lev”.

  • method (str, optional) – String that is the interpolation method; can be either “linear” or “log”. Defaults to “linear”.

  • extrapolate (bool, optional) – If True, below ground extrapolation for variable will be done using an ECMWF formulation. Defaults to False.

  • variable (str, optional) – String representing what variable is extrapolated below surface level. Temperature extrapolation = “temperature”. Geopotential height extrapolation = “geopotential”. All other variables = “other”. If “other”, the value of data at the lowest model level will be used as the below ground fill value. Required if extrapolate is True.

  • t_bot (xarray.DataArray, optional) – Temperature in Kelvin at the lowest layer of the model. Not necessarily the same as surface temperature. Required if extrapolate is True and variable is not 'other'

  • phi_sfc (xarray.DataArray, optional) – Geopotential in J/kg at the lowest layer of the model. Not necessarily the same as surface geopotential. Required if extrapolate is True and variable is not 'other'.

Returns:

output (xarray.DataArray) – Interpolated data with isobaric levels

See also

Related NCL Functions: vinth2p, vinth2p_ecmwf