apply the sfr observation process - pairs with setup_sfr_obs().
    requires sfr_obs.config.  Writes <sfr_out_file>.processed, where
    <sfr_out_file> is defined in "sfr_obs.config"


    Parameters
    ----------
    None

    Returns
    -------
    df : pd.DataFrame
        a dataframe of aggregrated sfr segment aquifer and outflow

def apply_sfr_obs():
    """apply the sfr observation process - pairs with setup_sfr_obs().
    requires sfr_obs.config.  Writes <sfr_out_file>.processed, where
    <sfr_out_file> is defined in "sfr_obs.config"


    Parameters
    ----------
    None

    Returns
    -------
    df : pd.DataFrame
        a dataframe of aggregrated sfr segment aquifer and outflow
    """
    assert os.path.exists("sfr_obs.config")
    df_key = pd.read_csv("sfr_obs.config",index_col=0)

    assert df_key.iloc[0,0] == "sfr_out_file",df_key.iloc[0,:]
    sfr_out_file = df_key.iloc[0,1]
    df_key = df_key.iloc[1:,:]
    df_key.loc[:, "segment"] = df_key.segment.apply(np.int)
    df_key.index = df_key.segment
    seg_group_dict = df_key.groupby(df_key.obs_base).groups

    sfr_kper = load_sfr_out(sfr_out_file)
    kpers = list(sfr_kper.keys())
    kpers.sort()
    #results = {o:[] for o in seg_group_dict.keys()}
    results = []
    for kper in kpers:
        df = sfr_kper[kper]
        for obs_base,segs in seg_group_dict.items():
            agg = df.loc[segs.values,:].sum()  # still agg flout where seg groups are passed!
            #print(obs_base,agg)
            results.append([kper,obs_base,agg["flaqx"],agg["flout"]])
    df = pd.DataFrame(data=results,columns=["kper","obs_base","flaqx","flout"])
    df.sort_values(by=["kper","obs_base"],inplace=True)
    df.to_csv(sfr_out_file+".processed",sep=' ',index=False)
    return df