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

Changeset 80

Show
Ignore:
Timestamp:
09/18/07 16:09:48
Author:
cbc
Message:

Fulfill ticket #20: Compute u,v arrays.

Files:

Legend:

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

    r79 r80  
    2626        self.minAltitude = data.minAltitude 
    2727        self.maxAltitude = data.maxAltitude 
    28         self._azimuth(data) 
     28        self._thetas(data) 
     29        self._uComponents(data) 
     30        self._vComponents(data) 
     31        self._wComponents(data) 
    2932     
    30     def _azimuth(self, data): 
     33    def _thetas(self, data): 
    3134        """Convert direction to polar azimuth in radians CW from North""" 
    32         self.azimuth = n.array([[altitude['DIR'] 
    33                                  for altitude 
    34                                  in sample['body']] 
    35                                 for sample in data]) 
    36         self.azimuth = n.pi * (self.azimuth / 180) 
     35        self.thetas = n.pi * (n.array(data.thetas()) / 180) 
     36     
     37    def _uComponents(self,data): 
     38        """Compute u component array""" 
     39        self.uComponents = n.array(data.radials()) * n.cos(self.thetas) 
     40     
     41    def _vComponents(self,data): 
     42        """Compute v component array""" 
     43        self.vComponents = n.array(data.radials()) * n.sin(self.thetas) 
     44     
     45    def _wComponents(self,data): 
     46        """Create w component array""" 
     47        self.wComponents = n.array(data.wComponents()) 
    3748 
    3849 
     
    5061    formattedDataObject = formattedData.FormattedData(rawDataObject) 
    5162    arrayDataObject = ArrayData(formattedDataObject) 
    52     print arrayDataObject.azimuth 
     63    print arrayDataObject.thetas 
     64    print arrayDataObject.uComponents 
     65    print arrayDataObject.vComponents 
     66    print arrayDataObject.wComponents 
    5367 
    5468if __name__ == "__main__": 
  • sodar/trunk/sodar/formattedData.py

    r78 r80  
    3434        super(FormattedData, self).__init__() 
    3535        self.extend([sample.data() for sample in data]) 
    36         self._format() 
    37      
    38     def _format(self): 
    39         """Format raw sodar daily data.""" 
    4036        self._convert() 
    4137        self._stamp() 
     
    4541        self._numAltitudes() 
    4642        self._altInterval() 
    47         # correct for missing times 
    48         # correct for missing altitudes 
    49         # mark maximum altitude with good values for each sample 
    50         # mark minimum altitude with invalid values for each sample 
    51         # convert direction to radians 
    52         # compute u,v,c components 
    53         # compute colorspecs 
    54         # compute plotting parameters 
    5543     
    5644    def _convert(self): 
     
    11199        self.altInterval = (self.maxAltitude - self.minAltitude) / \ 
    112100                           (self.numAltitudes - 1) 
     101     
     102    def thetas(self): 
     103        """Create a list of lists of horizontal directional data.""" 
     104        return [[altitude['DIR'] 
     105                 for altitude 
     106                 in sample['body']] 
     107                for sample in self] 
     108     
     109    def radials(self): 
     110        """Create a list of lists of horizontal radial velocity data.""" 
     111        return [[altitude['SPEED'] 
     112                 for altitude 
     113                 in sample['body']] 
     114                for sample in self] 
     115     
     116    def wComponents(self): 
     117        """Create a list of lists of vertical velocity data.""" 
     118        return [[altitude['W'] 
     119                 for altitude 
     120                 in sample['body']] 
     121                for sample in self] 
    113122 
    114123 
  • sodar/trunk/sodar/rawData.py

    r78 r80  
    173173     
    174174    def data(self): 
    175         """Create a shallow copy of the data as a dictionary.""" 
     175        """Create a deep/shallow copy of the data as a dictionary.""" 
    176176        return self.copy() 
    177177