NCCOOS Trac Projects: Top | Web | Platforms | Processing | Viz | Sprints | Sandbox | (Wind)

Changeset 272

Show
Ignore:
Timestamp:
12/07/09 16:36:49
Author:
cbc
Message:

Merge raw2proc-dev branch changes.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • sodar/trunk/sodar/rawData.py

    r120 r272  
    137137     
    138138    def __getitem__(self, index): 
    139         """Index Sample by body attribute.""" 
     139        """Index Sample by body or header attribute.""" 
    140140        try: 
    141141            return self.body[index] 
    142142        except TypeError:   # sample.body may not exist 
    143143            raise IndexError('Sample index out of range') 
     144        except IndexError:  # sample.body out of range 
     145            try: 
     146                return self.header[index] 
     147            except KeyError: # sample.header may not exist 
     148                raise IndexError('Sample index out of range') 
    144149     
    145150    def data(self): 
     
    218223                continue 
    219224            return altitude 
    220         raise IndexError('Body index, out of range') 
     225        raise IndexError('Body index out of range') 
    221226 
    222227    def data(self):