Changeset 69
- Timestamp:
- 08/20/07 19:19:22
- Files:
-
- sodar/trunk/sodar/data.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
sodar/trunk/sodar/data.py
r68 r69 114 114 self._convert() 115 115 self._stamp() 116 self._ timeInterval()116 self._sampleInterval() 117 117 # correct for missing times 118 # compute minium altitude118 self._minimumAltitude() 119 119 # compute maximum overall altitude 120 120 # compute number of altitudes … … 165 165 sample['stamp'] = datatime.datetime.min 166 166 167 def _ timeInterval(self):168 """Add a time interval attribute"""167 def _sampleInterval(self): 168 """Add a sample interval attribute.""" 169 169 intervals = zip([sample['stamp'] for sample in self.samples[:-1]], 170 170 [sample['stamp'] for sample in self.samples[1:]]) … … 179 179 for key,value in accumulator.items(): 180 180 if value == maxVotes: 181 self. timeInterval = key181 self.sampleInterval = key 182 182 break 183 self. timeInterval = getattr(self,184 ' timeInterval',183 self.sampleInterval = getattr(self, 184 'sampleInterval', 185 185 datetime.timedelta.resolution) 186 187 def _minimumAltitude(self): 188 """Add a minimum altitude attribute.""" 189 accumulator = {} 190 for sample in self.samples: 191 minalt = sample['body'][0]['ALT'] 192 sample['header']['minalt'] = minalt 193 if minalt is not n.NaN: 194 if minalt in accumulator: 195 accumulator[minalt] += 1 196 else: 197 accumulator[minalt] = 1 198 maxVotes = max(accumulator.values()) 199 for key,value in accumulator.items(): 200 if value == maxVotes: 201 self.minimumAltitude = key 202 break 203 self.minimumAltitude = getattr(self, 204 'minimumAltitude', 205 0.0) 186 206 187 207