def height_to_geopotential(height):
    r"""Compute geopotential for a given height.

    Parameters
    ----------
    height : `pint.Quantity`
        Height above sea level (array_like)

    Returns
    -------
    `pint.Quantity`
        The corresponding geopotential value(s)

    Examples
    --------
    >>> from metpy.constants import g, G, me, Re
    >>> import metpy.calc
    >>> from metpy.units import units
    >>> height = np.linspace(0,10000, num = 11) * units.m
    >>> geopot = metpy.calc.height_to_geopotential(height)
    >>> geopot
    <Quantity([     0.           9817.46806283  19631.85526579  29443.16305888
    39251.39289118  49056.54621087  58858.62446525  68657.62910064
    78453.56156253  88246.42329545  98036.21574306], 'meter ** 2 / second ** 2')>

    Notes
    -----
    Derived from definition of geopotential in [Hobbs2006]_ pg.14 Eq.1.8.

    """
    # Calculate geopotential
    geopot = mpconsts.G * mpconsts.me * ((1 / mpconsts.Re) - (1 / (mpconsts.Re + height)))

    return geopot
def height_to_geopotential ( height ) : geopot = mpconsts . G * mpconsts . me * ( ( 1 / mpconsts . Re ) - ( 1 / ( mpconsts . Re + height ) ) ) return geopot
r"""Compute geopotential for a given height.

    Parameters
    ----------
    height : `pint.Quantity`
        Height above sea level (array_like)

    Returns
    -------
    `pint.Quantity`
        The corresponding geopotential value(s)

    Examples
    --------
    >>> from metpy.constants import g, G, me, Re
    >>> import metpy.calc
    >>> from metpy.units import units
    >>> height = np.linspace(0,10000, num = 11) * units.m
    >>> geopot = metpy.calc.height_to_geopotential(height)
    >>> geopot
    <Quantity([     0.           9817.46806283  19631.85526579  29443.16305888
    39251.39289118  49056.54621087  58858.62446525  68657.62910064
    78453.56156253  88246.42329545  98036.21574306], 'meter ** 2 / second ** 2')>

    Notes
    -----
    Derived from definition of geopotential in [Hobbs2006]_ pg.14 Eq.1.8.