Changeset 6104 for qesdi


Ignore:
Timestamp:
11/12/09 13:46:27 (10 years ago)
Author:
pnorton
Message:

Fixed a bug that occurs when a completely masked dataset is selected.

Location:
qesdi/geoplot/trunk/lib/geoplot
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • qesdi/geoplot/trunk/lib/geoplot/grid_builder_base.py

    r6029 r6104  
    7878        varMin, varMax = self._getVarMinAndMax() 
    7979 
    80         infValueFound = False 
    81          
    82         if varMax == N.inf: 
    83             infValueFound = True 
    84             varMax =  self._maskInfValsInVar(self.cdmsVar).max() 
    85    
     80        infValueFound, varMax = self._checkVarMaxForInf(varMax) 
     81           
    8682        st = time.time() 
    8783        reducedVar = self._getResizedVar(xLimits, yLimits) 
    8884        log.debug("Reduced variable in %ss" % (time.time() - st,)) 
    8985 
    90  
    9186        st = time.time()     
    9287        (gridBoundsX, gridBoundsY) = self._buildGridBounds(reducedVar) 
     
    10297         
    10398        if infValueFound: 
     99            # if there was an inf value found in the full variable 
     100            # there may be one in the reduced one, so mask any found 
    104101            gridValues = self._maskInfValsInVar(gridValues) 
    105                  
    106          
    107          
     102                         
    108103#        log.debug("After resize:") 
    109104#        log.debug("y midpoints min =[" + str(gridMidpointY.min()) + \ 
     
    124119                    varMax, varMin) 
    125120 
     121    def _checkVarMaxForInf(self, varMax): 
     122        """ 
     123        Checks if varMax is an infinite value, if it is will compute the 
     124        non-infitite maximum. 
     125        """ 
     126         
     127        infValueFound = False 
     128         
     129        if not hasattr(varMax, 'mask') and varMax == N.inf: 
     130            infValueFound = True 
     131             
     132            # need to make sure we get the max from the non-reduced variable 
     133            varMax =  self._maskInfValsInVar(self.cdmsVar).max() 
     134             
     135        return infValueFound, varMax         
     136 
    126137    def _getResizedVar(self, xLimits, yLimits): 
    127138        """ 
  • qesdi/geoplot/trunk/lib/geoplot/grid_builder_lat_lon_subset.py

    r6029 r6104  
    5757        varMin, varMax = self._getVarMinAndMax() 
    5858         
    59         infValueFound = False 
    60          
    61         if varMax == N.inf: 
    62             infValueFound = True 
    63             varMax =  self._maskInfValsInVar(self.cdmsVar).max() 
     59        infValueFound, varMax = self._checkVarMaxForInf(varMax) 
    6460 
    6561        reducedVar = self._getResizedVar(xLimits, yLimits) 
     
    9995         
    10096        if infValueFound: 
     97            # if there was an inf value found in the full variable 
     98            # there may be one in the reduced one, so mask any found 
    10199            gridValues = self._maskInfValsInVar(gridValues) 
    102100 
Note: See TracChangeset for help on using the changeset viewer.