def get_df_val_alt(lat: float, lon: float, da_alt_meas: xr.DataArray, ds_val: xr.Dataset):
    '''interpolate atmospheric variables to a specified altitude

    Parameters
    ----------
    lat : float
        latitude of specified site
    lon : float
        longitude of specified site
    da_alt_x : xr.DataArray
        desired altitude to interpolate variable at
    da_alt : xr.DataArray
        altitude associated with `da_val`: variable array to interpolate
    da_val : xr.DataArray
        atmospheric varialble to interpolate

    Returns
    -------
    pd.DataFrame
        interpolated values at the specified altitude of site positioned by [`lat`, `lon`]
    '''
    da_alt = geopotential2geometric(ds_val.z, ds_val.latitude)
    # generate pressure series for grid x
    da_alt_x = da_alt.sel(
        latitude=lat, longitude=lon, method='nearest')
    alt_meas_x = da_alt_meas.sel(
        latitude=lat, longitude=lon, method='nearest')[0]

    val_pres = np.array([interp1d(alt, da_alt_x.level)(alt_meas_x)
                         for alt in da_alt_x])
    df_val_alt = pd.concat(
        [get_ser_val_alt(
            lat, lon, da_alt_meas, da_alt, ds_val[var])
         for var in ds_val.data_vars],
        axis=1
    )
    #     add pressure
    df_val_alt['p'] = val_pres
    df_val_alt.index = df_val_alt.index.set_names('time')
    df_val_alt.columns = df_val_alt.columns.set_names('var')

    return df_val_alt
def get_df_val_alt ( lat : float , lon : float , da_alt_meas : xr . DataArray , ds_val : xr . Dataset ) : da_alt = geopotential2geometric ( ds_val . z , ds_val . latitude ) da_alt_x = da_alt . sel ( latitude = lat , longitude = lon , method = 'nearest' ) alt_meas_x = da_alt_meas . sel ( latitude = lat , longitude = lon , method = 'nearest' ) [ 0 ] val_pres = np . array ( [ interp1d ( alt , da_alt_x . level ) ( alt_meas_x ) for alt in da_alt_x ] ) df_val_alt = pd . concat ( [ get_ser_val_alt ( lat , lon , da_alt_meas , da_alt , ds_val [ var ] ) for var in ds_val . data_vars ] , axis = 1 ) df_val_alt [ 'p' ] = val_pres df_val_alt . index = df_val_alt . index . set_names ( 'time' ) df_val_alt . columns = df_val_alt . columns . set_names ( 'var' ) return df_val_alt
interpolate atmospheric variables to a specified altitude

    Parameters
    ----------
    lat : float
        latitude of specified site
    lon : float
        longitude of specified site
    da_alt_x : xr.DataArray
        desired altitude to interpolate variable at
    da_alt : xr.DataArray
        altitude associated with `da_val`: variable array to interpolate
    da_val : xr.DataArray
        atmospheric varialble to interpolate

    Returns
    -------
    pd.DataFrame
        interpolated values at the specified altitude of site positioned by [`lat`, `lon`]