Example #1
0
def _write_header_param(fout, paramName, paramVal):
    from spectral.utilities.python23 import is_string
    if paramName.lower() == 'description':
        valStr = '{\n%s}' % '\n'.join(
            ['  ' + line for line in paramVal.split('\n')])
    elif not is_string(paramVal) and hasattr(paramVal, '__len__'):
        valStr = '{ %s }' % (' , '.join(
            [str(v).replace(',', '-') for v in paramVal]), )
    else:
        valStr = str(paramVal)
    fout.write('%s = %s\n' % (paramName, valStr))
Example #2
0
def _write_header_param(fout, paramName, paramVal):
    from spectral.utilities.python23 import is_string
    if paramName.lower() == 'description':
        valStr = '{\n%s}' % '\n'.join(['  ' + line for line
                                       in paramVal.split('\n')])
    elif not is_string(paramVal) and hasattr(paramVal, '__len__'):
        valStr = '{ %s }' % (
            ' , '.join([str(v).replace(',', '-') for v in paramVal]),)
    else:
        valStr = str(paramVal)
    fout.write('%s = %s\n' % (paramName, valStr))
Example #3
0
def check_compatibility(header):
    '''
    Verifies that all features of an ENVI header are supported.
    '''
    from .spyfile import find_file_path
    from spectral.utilities.python23 import is_string
    if is_string(header):
        header = read_envi_header(find_file_path(header))
    if _has_frame_offset(header):
        raise EnviFeatureNotSupported(
            'ENVI image frame offsets are not supported.')
Example #4
0
def check_compatibility(header):
    '''
    Verifies that all features of an ENVI header are supported.
    '''
    from .spyfile import find_file_path
    from spectral.utilities.python23 import is_string
    if is_string(header):
        header = read_envi_header(find_file_path(header))
    if _has_frame_offset(header):
        raise EnviFeatureNotSupported(
            'ENVI image frame offsets are not supported.')
Example #5
0
def check_compatibility(header):
    '''
    Verifies that all features of an ENVI header are supported.
    '''
    from .spyfile import find_file_path
    from spectral.utilities.python23 import is_string
    if is_string(header):
        header = read_envi_header(find_file_path(header))

    mandatory_params = ['lines', 'samples', 'bands', 'data type',
                        'interleave', 'byte order']
    for p in mandatory_params:
        if p not in header:
            raise MissingEnviHeaderParameter(p)

    if _has_frame_offset(header):
        raise EnviFeatureNotSupported(
            'ENVI image frame offsets are not supported.')
Example #6
0
def check_compatibility(header):
    '''
    Verifies that all features of an ENVI header are supported.
    '''
    from .spyfile import find_file_path
    from spectral.utilities.python23 import is_string
    if is_string(header):
        header = read_envi_header(find_file_path(header))

    mandatory_params = [
        'lines', 'samples', 'bands', 'data type', 'interleave', 'byte order'
    ]
    for p in mandatory_params:
        if p not in header:
            raise MissingEnviHeaderParameter(p)

    if _has_frame_offset(header):
        raise EnviFeatureNotSupported(
            'ENVI image frame offsets are not supported.')