write a grid-based template file
    Parameters
    ----------
    name : str
        the base parameter name
    tpl_file : str
        the template file to write - include path
    zn_array : numpy.ndarray
        an array used to skip inactive cells

    Returns
    -------
    df : pandas.DataFrame
        a dataframe with parameter information

def write_grid_tpl(name, tpl_file, suffix, zn_array=None, shape=None,
                   spatial_reference=None,longnames=False):
    """ write a grid-based template file
    Parameters
    ----------
    name : str
        the base parameter name
    tpl_file : str
        the template file to write - include path
    zn_array : numpy.ndarray
        an array used to skip inactive cells

    Returns
    -------
    df : pandas.DataFrame
        a dataframe with parameter information

    """

    if shape is None and zn_array is None:
        raise Exception("must pass either zn_array or shape")
    elif shape is None:
        shape = zn_array.shape

    parnme, x, y = [], [], []
    with open(tpl_file, 'w') as f:
        f.write("ptf ~\n")
        for i in range(shape[0]):
            for j in range(shape[1]):
                if zn_array is not None and zn_array[i, j] < 1:
                    pname = ' 1.0 '
                else:
                    if longnames:
                        pname = "{0}_i:{0}_j:{1}_{2}".format(name,i,j,suffix)
                        if spatial_reference is not None:
                            pname += "_x:{0:10.2E}_y:{1:10.2E}".format(sr.xcentergrid[i,j],
                                                                       sr.ycentergrid[i,j])
                    else:
                        pname = "{0}{1:03d}{2:03d}".format(name, i, j)
                        if len(pname) > 12:
                            raise("grid pname too long:{0}". \
                                               format(pname))
                    parnme.append(pname)
                    pname = ' ~     {0}   ~ '.format(pname)
                    if spatial_reference is not None:
                        x.append(spatial_reference.xcentergrid[i, j])
                        y.append(spatial_reference.ycentergrid[i, j])

                f.write(pname)
            f.write("\n")
    df = pd.DataFrame({"parnme": parnme}, index=parnme)
    if spatial_reference is not None:
        df.loc[:,'x'] = x
        df.loc[:,'y'] = y
    df.loc[:, "pargp"] = "{0}{1}".format(suffix.replace('_', ''), name)
    df.loc[:, "tpl"] = tpl_file
    return df