nappy/contrib/aircraft/aircraftData.py
def _getMaskedArray(self, var, flagVar=None, flagValues=(0,1), missingValuesToTest=(-9999., -32767.)):
        """
        Returns a masked array that has the values only present where the flag
        values are acceptable and the data itself is not missing.
        """
        if flagVar:
            flagFillValue=-1
            flagGTValue=max(flagValues)

            flagMaskWhereUnacceptable=MA.masked_greater(flagVar, flagGTValue).mask()
            flagMaskWhereMissing=MA.masked_equal(flagVar, flagFillValue).mask()
            flagMask=flagMaskWhereUnacceptable+flagMaskWhereMissing

        for fv in missingValuesToTest:
            if fv in MV.ravel(var):
                print "Setting missing value for '%s' as: %s" % (var.id, fv)
                varFillValue=fv
        else:
            varFillValue=missingValuesToTest[0]

        if flagVar:
            varMask=MA.masked_array(var, mask=MA.equal(var, varFillValue), fill_value=varFillValue).mask()
            fullmask=MA.bitwise_or(varMask, flagMask)
            maskedArray=MA.masked_array(var, mask=fullmask, fill_value=varFillValue)
        else:
            maskedArray=MA.masked_array(var, mask=MA.equal(var, varFillValue), fill_value=varFillValue)

        #maskedArray=cdms.createVariable(maskedArray, id=var.id, fill_value=varFillValue)
        #maskedArray.missing_value=varFillValue
        return maskedArray

        Returns a masked array that has the values only present where the flag
        values are acceptable and the data itself is not missing.
        
Returns a masked array that has the values only present where the flag
values are acceptable and the data itself is not missing.
Returns a masked array that has the values only present where the flag values are acceptable and the data itself is not missing .
def _getMaskedArray(self, var, flagVar=None, flagValues=(0,1), missingValuesToTest=(-9999., -32767.)):
        if flagVar:
            flagFillValue=-1
            flagGTValue=max(flagValues)
            flagMaskWhereUnacceptable=MA.masked_greater(flagVar, flagGTValue).mask()
            flagMaskWhereMissing=MA.masked_equal(flagVar, flagFillValue).mask()
            flagMask=flagMaskWhereUnacceptable+flagMaskWhereMissing
        for fv in missingValuesToTest:
            if fv in MV.ravel(var):
                print "Setting missing value for '%s' as: %s" % (var.id, fv)
                varFillValue=fv
        else:
            varFillValue=missingValuesToTest[0]
        if flagVar:
            varMask=MA.masked_array(var, mask=MA.equal(var, varFillValue), fill_value=varFillValue).mask()
            fullmask=MA.bitwise_or(varMask, flagMask)
            maskedArray=MA.masked_array(var, mask=fullmask, fill_value=varFillValue)
        else:
            maskedArray=MA.masked_array(var, mask=MA.equal(var, varFillValue), fill_value=varFillValue)
        return maskedArray
def _getMaskedArray ( self , var , flagVar = None , flagValues = ( 0 , 1 ) , missingValuesToTest = ( - 9999. , - 32767. ) ) : if flagVar : flagFillValue = - 1 flagGTValue = max ( flagValues ) flagMaskWhereUnacceptable = MA . masked_greater ( flagVar , flagGTValue ) . mask ( ) flagMaskWhereMissing = MA . masked_equal ( flagVar , flagFillValue ) . mask ( ) flagMask = flagMaskWhereUnacceptable + flagMaskWhereMissing for fv in missingValuesToTest : if fv in MV . ravel ( var ) : print "Setting missing value for '%s' as: %s" % ( var . id , fv ) varFillValue = fv else : varFillValue = missingValuesToTest [ 0 ] if flagVar : varMask = MA . masked_array ( var , mask = MA . equal ( var , varFillValue ) , fill_value = varFillValue ) . mask ( ) fullmask = MA . bitwise_or ( varMask , flagMask ) maskedArray = MA . masked_array ( var , mask = fullmask , fill_value = varFillValue ) else : maskedArray = MA . masked_array ( var , mask = MA . equal ( var , varFillValue ) , fill_value = varFillValue ) return maskedArray
Returns a masked array that has the values only present where the flag
values are acceptable and the data itself is not missing.
Returns a masked array that has the values only present where the flag values are acceptable and the data itself is not missing .
"""
        Returns a masked array that has the values only present where the flag
        values are acceptable and the data itself is not missing.
        """ #maskedArray=cdms.createVariable(maskedArray, id=var.id, fill_value=varFillValue) #maskedArray.missing_value=varFillValue
self
var
flagVar
flagValues
missingValuesToTest