コード例 #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))
コード例 #2
0
ファイル: envi.py プロジェクト: appscluster/spectral
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))
コード例 #3
0
ファイル: envi.py プロジェクト: avstjohn/spectral
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.')
コード例 #4
0
ファイル: envi.py プロジェクト: physici/spectral
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.')
コード例 #5
0
ファイル: envi.py プロジェクト: spectralpython/spectral
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.')
コード例 #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.')