write a template file for a modflow parameter value file.
    Uses names in the first column in the pval file as par names.

    Parameters
    ----------
    pval_file : str
        parameter value file
    tpl_file : str, optional
        template file to write.  If None, use <pval_file>.tpl.
        Default is None

    Returns
    -------
    df : pandas.DataFrame
        pandas DataFrame with control file parameter information

def modflow_pval_to_template_file(pval_file,tpl_file=None):
    """write a template file for a modflow parameter value file.
    Uses names in the first column in the pval file as par names.

    Parameters
    ----------
    pval_file : str
        parameter value file
    tpl_file : str, optional
        template file to write.  If None, use <pval_file>.tpl.
        Default is None

    Returns
    -------
    df : pandas.DataFrame
        pandas DataFrame with control file parameter information
    """

    if tpl_file is None:
        tpl_file = pval_file + ".tpl"
    pval_df = pd.read_csv(pval_file,delim_whitespace=True,
                          header=None,skiprows=2,
                          names=["parnme","parval1"])
    pval_df.index = pval_df.parnme
    pval_df.loc[:,"tpl"] = pval_df.parnme.apply(lambda x: " ~   {0:15s}   ~".format(x))
    with open(tpl_file,'w') as f:
        f.write("ptf ~\n#pval template file from pyemu\n")
        f.write("{0:10d} #NP\n".format(pval_df.shape[0]))
        f.write(pval_df.loc[:,["parnme","tpl"]].to_string(col_space=0,
                                                          formatters=[SFMT,SFMT],
                                                          index=False,
                                                          header=False,
                                                          justify="left"))
    return pval_df