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

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

File:
1 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        """ 
Note: See TracChangeset for help on using the changeset viewer.