read in a binary hydmod file and return a dataframe of the results

    Parameters
    ----------
    hydmod_file : str
        modflow hydmod binary file
    hydmod_outfile : str
        output file to write.  If None, use <hydmod_file>.dat.
        Default is None

    Returns
    -------
    df : pandas.DataFrame
        pandas DataFrame with hymod_file values

    Note
    ----
    requires flopy

def modflow_read_hydmod_file(hydmod_file, hydmod_outfile=None):
    """ read in a binary hydmod file and return a dataframe of the results

    Parameters
    ----------
    hydmod_file : str
        modflow hydmod binary file
    hydmod_outfile : str
        output file to write.  If None, use <hydmod_file>.dat.
        Default is None

    Returns
    -------
    df : pandas.DataFrame
        pandas DataFrame with hymod_file values

    Note
    ----
    requires flopy
    """
    try:
        import flopy.utils as fu
    except Exception as e:
        print('flopy is not installed - cannot read {0}\n{1}'.format(hydmod_file, e))
        return
    #print('Starting to read HYDMOD data from {0}'.format(hydmod_file))
    obs = fu.HydmodObs(hydmod_file)
    hyd_df = obs.get_dataframe()

    hyd_df.columns = [i[2:] if i.lower() != 'totim' else i for i in hyd_df.columns]
    #hyd_df.loc[:,"datetime"] = hyd_df.index
    hyd_df['totim'] = hyd_df.index.map(lambda x: x.strftime("%Y%m%d"))

    hyd_df.rename(columns={'totim': 'datestamp'}, inplace=True)


    # reshape into a single column
    hyd_df = pd.melt(hyd_df, id_vars='datestamp')

    hyd_df.rename(columns={'value': 'obsval'}, inplace=True)

    hyd_df['obsnme'] = [i.lower() + '_' + j.lower() for i, j in zip(hyd_df.variable, hyd_df.datestamp)]

    vc = hyd_df.obsnme.value_counts().sort_values()
    vc = list(vc.loc[vc>1].index.values)
    if len(vc) > 0:
        hyd_df.to_csv("hyd_df.duplciates.csv")
        obs.get_dataframe().to_csv("hyd_org.duplicates.csv")
        raise Exception("duplicates in obsnme:{0}".format(vc))
    #assert hyd_df.obsnme.value_counts().max() == 1,"duplicates in obsnme"

    if not hydmod_outfile:
        hydmod_outfile = hydmod_file + '.dat'
    hyd_df.to_csv(hydmod_outfile, columns=['obsnme','obsval'], sep=' ',index=False)
    #hyd_df = hyd_df[['obsnme','obsval']]
    return hyd_df[['obsnme','obsval']], hydmod_outfile