Exemple #1
0
    def writeGEFDCControlFile(self, outputdir=None, filename='gefdc.inp',
                              bathyrows=0, title='test'):
        """
        Generates the GEFDC control (gefdc.inp) file for the EFDC grid
        preprocessor.

        Parameters
        ----------
        outputdir : str, optional
            The path to where the should be saved.
        filename : str, optional
            The name of the output file.
        bathyrows : int, optional
            The number of rows in the grid's bathymetry data file.
        title : str, optional
            The title of the grid as portrayed in ``filename``.

        Returns
        -------
        gefdc : str
            The text of the output file.

        """

        outfile = iotools._outputfile(outputdir, filename)

        gefdc = iotools._write_gefdc_control_file(
            outfile,
            title,
            self.inodes + 1,
            self.jnodes + 1,
            bathyrows
        )
        return gefdc
Exemple #2
0
def test__write_gefdc_control_file():
    known_filename = 'pygridtools/tests/baseline_files/maingefdc.inp'
    result_filename = 'pygridtools/tests/result_files/maingefdc.inp'
    iotools._write_gefdc_control_file(result_filename, 'Test Input File', 100, 25, 0)
    testing.compareTextFiles(result_filename, known_filename)