pyroSAR/gamma/parser.py
def parse_module(bindir, outfile):
    """
    parse all Gamma commands of a module to functions and save them to a Python script.

    Parameters
    ----------
    bindir: str
        the `bin` directory of a module containing the commands
    outfile: str
        the name of the Python file to write

    Returns
    -------
    
    Examples
    --------
    >>> import os
    >>> from pyroSAR.gamma.parser import parse_module
    >>> outname = os.path.join(os.environ['HOME'], 'isp.py')
    >>> parse_module('/cluster/GAMMA_SOFTWARE-20161207/ISP/bin', outname)
    """
    excludes = ['coord_trans', 'mosaic', 'lin_comb', 'lin_comb_cpx', 'validate']
    failed = []
    outstring = 'from pyroSAR.gamma.auxil import process\n\n\n'
    for cmd in sorted(finder(bindir, ['*']), key=lambda s: s.lower()):
        basename = os.path.basename(cmd)
        if basename not in excludes:
            # print(basename)
            try:
                fun = parse_command(cmd)
            except RuntimeError as e:
                failed.append('{0}: {1}'.format(basename, str(e)))
                continue
            outstring += fun + '\n\n'
    with open(outfile, 'w') as out:
        out.write(outstring)
    if len(failed) > 0:
        print('the following functions could not be parsed:\n{0}\n({1} total)'.format('\n'.join(failed), len(failed)))

    parse all Gamma commands of a module to functions and save them to a Python script.

    Parameters
    ----------
    bindir: str
        the `bin` directory of a module containing the commands
    outfile: str
        the name of the Python file to write

    Returns
    -------
    
    Examples
    --------
    >>> import os
    >>> from pyroSAR.gamma.parser import parse_module
    >>> outname = os.path.join(os.environ['HOME'], 'isp.py')
    >>> parse_module('/cluster/GAMMA_SOFTWARE-20161207/ISP/bin', outname)
    
parse all Gamma commands of a module to functions and save them to a Python script.
Parameters

str
the `bin` directory of a module containing the commands
outfile: str
the name of the Python file to write

Returns

Examples


parse all Gamma commands of a module to functions and save them to a Python script . Parameters str the ` bin ` directory of a module containing the commands outfile : str the name of the Python file to write Returns Examples
def parse_module(bindir, outfile):
    excludes = ['coord_trans', 'mosaic', 'lin_comb', 'lin_comb_cpx', 'validate']
    failed = []
    outstring = 'from pyroSAR.gamma.auxil import process\n\n\n'
    for cmd in sorted(finder(bindir, ['*']), key=lambda s: s.lower()):
        basename = os.path.basename(cmd)
        if basename not in excludes:
            try:
                fun = parse_command(cmd)
            except RuntimeError as e:
                failed.append('{0}: {1}'.format(basename, str(e)))
                continue
            outstring += fun + '\n\n'
    with open(outfile, 'w') as out:
        out.write(outstring)
    if len(failed) > 0:
        print('the following functions could not be parsed:\n{0}\n({1} total)'.format('\n'.join(failed), len(failed)))
def parse_module ( bindir , outfile ) : excludes = [ 'coord_trans' , 'mosaic' , 'lin_comb' , 'lin_comb_cpx' , 'validate' ] failed = [ ] outstring = 'from pyroSAR.gamma.auxil import process\n\n\n' for cmd in sorted ( finder ( bindir , [ '*' ] ) , key = lambda s : s . lower ( ) ) : basename = os . path . basename ( cmd ) if basename not in excludes : try : fun = parse_command ( cmd ) except RuntimeError as e : failed . append ( '{0}: {1}' . format ( basename , str ( e ) ) ) continue outstring += fun + '\n\n' with open ( outfile , 'w' ) as out : out . write ( outstring ) if len ( failed ) > 0 : print ( 'the following functions could not be parsed:\n{0}\n({1} total)' . format ( '\n' . join ( failed ) , len ( failed ) ) )
parse all Gamma commands of a module to functions and save them to a Python script.
parse all Gamma commands of a module to functions and save them to a Python script .
"""
    parse all Gamma commands of a module to functions and save them to a Python script.

    Parameters
    ----------
    bindir: str
        the `bin` directory of a module containing the commands
    outfile: str
        the name of the Python file to write

    Returns
    -------
    
    Examples
    --------
    >>> import os
    >>> from pyroSAR.gamma.parser import parse_module
    >>> outname = os.path.join(os.environ['HOME'], 'isp.py')
    >>> parse_module('/cluster/GAMMA_SOFTWARE-20161207/ISP/bin', outname)
    """ # print(basename)
bindir
outfile