Package peppy :: Package hsi :: Module ENVI :: Class Header
[frames] | no frames]

Class Header

        object --+    
                 |    
              dict --+
                     |
        object --+   |
                 |   |
cube.MetadataMixin --+
                     |
                    Header

Class representing the text fields of an ENVI format header, with the ability to populate an Cube with the parsed values from this text.

When initially loading this class, all that is done is to parse the text into name/value pairs. Conversion from text to something more interesting, like the actual values or lists of values is not done until you call getCube, which then creates an Cube instance and populates its fields with the values parsed from the ENVI header text.

Instance Methods
new empty dictionary

__init__(self, filename=None, debug=False)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
 
open(self, filename=None)
Open the header file, and if successful parse it.
 
save(self, filename=None)
 
read(self, fh)
parse the header file for the ENVI key/value pairs.
 
fixup(self)
convert any nonstandard keys here...
 
convertList(self, orig, txt, converter=<function <lambda> at 0x6893398>)
Use csv to parse the text into a list of values, and additionally convert those values according to the specified function (default: no conversion).
 
locateCube(self)
 
getCube(self, filename=None, index=0)
Return a cube instance that represents the data pointed to by the metadata.
 
getCubeNames(self)
Return names of cubes contained within this file.
 
getAttributeId(self, txt)
Convert ENVI header text string into the corresponding attribute ID of the Cube object
 
setCubeAttributes(self, cube)
Parse the text strings stored in the object (as a dictionary) into usable numbers, lists, and strings.
 
getCubeAttributes(self, cube)
Create header strings from the attributes in the cube.
 
str_string(self, key, val)
 
__str__(self)
str(x)

Inherited from dict: __cmp__, __contains__, __delitem__, __eq__, __ge__, __getattribute__, __getitem__, __gt__, __hash__, __iter__, __le__, __len__, __lt__, __ne__, __new__, __repr__, __setitem__, clear, copy, fromkeys, get, has_key, items, iteritems, iterkeys, itervalues, keys, pop, popitem, setdefault, update, values

Inherited from cube.MetadataMixin: fileExtensions, formatName, getNumCubes

Inherited from object: __delattr__, __reduce__, __reduce_ex__, __setattr__

Class Methods
 
getFilePair(cls, url)
 
identify(cls, urlinfo)
Scan through the file-like object to identify if it is a valid instance of the type that the subclass is expecting to load.
Class Variables
  format_id = 'ENVI'
  format_name = 'ENVI Datacube'
  extensions = ['.bil', '.bip', '.bsq', '.sli']
Properties

Inherited from object: __class__

Method Details

__init__(self, filename=None, debug=False)
(Constructor)

 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Returns:
new empty dictionary

Overrides: object.__init__
(inherited documentation)

identify(cls, urlinfo)
Class Method

 

Scan through the file-like object to identify if it is a valid instance of the type that the subclass is expecting to load.

Overrides: cube.MetadataMixin.identify
(inherited documentation)

open(self, filename=None)

 

Open the header file, and if successful parse it.

Overrides: cube.MetadataMixin.open

save(self, filename=None)

 
Overrides: cube.MetadataMixin.save

convertList(self, orig, txt, converter=<function <lambda> at 0x6893398>)

 

Use csv to parse the text into a list of values, and additionally convert those values according to the specified function (default: no conversion). Use the original value to determine if the final result should be reduced to a value instead of a one-element list.

getCube(self, filename=None, index=0)

 

Return a cube instance that represents the data pointed to by the metadata.

Overrides: cube.MetadataMixin.getCube
(inherited documentation)

getCubeNames(self)

 

Return names of cubes contained within this file.

Return a list of names that identify the cubes contained within this file.

Overrides: cube.MetadataMixin.getCubeNames
(inherited documentation)

setCubeAttributes(self, cube)

 

Parse the text strings stored in the object (as a dictionary) into usable numbers, lists, and strings. Store the resulting values in the Cube that is passed in as a parameter.

__str__(self)
(Informal representation operator)

 

str(x)

Overrides: object.__str__
(inherited documentation)