nappy/contrib/aircraft/old_na_to_nc_with_aircraft.py
def _useLocalRule(self, var, ruleArgs):
        """
        Applies some logic based on a local rule.
        """
        ruleName=ruleArgs[0]
        rule=ruleArgs
        if ruleName=="aircraft":
            # Fixes aircraft data 2D time axis, missing values and does sub-selection by default
            flagVar=None

            # return if variable is time
            if var.id=="Time":
                return None

            if len(rule)<2: rule.append("av")
            if len(rule)<3: rule.append("flag")
            if rule[2]=="flag":
                # Only use flag var for processing real variable
                if var.id.strip()[-4:]=="FLAG": 
                    print "Ignore flag: %s" % var.id
                    return None 

                flagID=var.id.strip()+"FLAG"
                try:
                    flagVar=self.cdmsfile(flagID)
                except:
                    raise "Cannot get flag variable for '%s'" % var.id
            elif rule[2]=="noflag":
                flagVar=None

            timeVar=self.cdmsfile("Time")
            import localRules.aircraftData
            ruleArgs=[rule[1]]+rule[3:]
            fixedVar=localRules.aircraftData.AircraftData(var, timeVar, flagVar, ruleArgs).subSampledVar
            return fixedVar
        else:
            raise "Rule '%s' not yet defined." % ruleName

        Applies some logic based on a local rule.
        
Applies some logic based on a local rule.
Applies some logic based on a local rule .
def _useLocalRule(self, var, ruleArgs):
        ruleName=ruleArgs[0]
        rule=ruleArgs
        if ruleName=="aircraft":
            flagVar=None
            if var.id=="Time":
                return None
            if len(rule)<2: rule.append("av")
            if len(rule)<3: rule.append("flag")
            if rule[2]=="flag":
                if var.id.strip()[-4:]=="FLAG": 
                    print "Ignore flag: %s" % var.id
                    return None 
                flagID=var.id.strip()+"FLAG"
                try:
                    flagVar=self.cdmsfile(flagID)
                except:
                    raise "Cannot get flag variable for '%s'" % var.id
            elif rule[2]=="noflag":
                flagVar=None
            timeVar=self.cdmsfile("Time")
            import localRules.aircraftData
            ruleArgs=[rule[1]]+rule[3:]
            fixedVar=localRules.aircraftData.AircraftData(var, timeVar, flagVar, ruleArgs).subSampledVar
            return fixedVar
        else:
            raise "Rule '%s' not yet defined." % ruleName
def _useLocalRule ( self , var , ruleArgs ) : ruleName = ruleArgs [ 0 ] rule = ruleArgs if ruleName == "aircraft" : flagVar = None if var . id == "Time" : return None if len ( rule ) < 2 : rule . append ( "av" ) if len ( rule ) < 3 : rule . append ( "flag" ) if rule [ 2 ] == "flag" : if var . id . strip ( ) [ - 4 : ] == "FLAG" : print "Ignore flag: %s" % var . id return None flagID = var . id . strip ( ) + "FLAG" try : flagVar = self . cdmsfile ( flagID ) except : raise "Cannot get flag variable for '%s'" % var . id elif rule [ 2 ] == "noflag" : flagVar = None timeVar = self . cdmsfile ( "Time" ) import localRules . aircraftData ruleArgs = [ rule [ 1 ] ] + rule [ 3 : ] fixedVar = localRules . aircraftData . AircraftData ( var , timeVar , flagVar , ruleArgs ) . subSampledVar return fixedVar else : raise "Rule '%s' not yet defined." % ruleName
Applies some logic based on a local rule.
Applies some logic based on a local rule .
"""
        Applies some logic based on a local rule.
        """ # Fixes aircraft data 2D time axis, missing values and does sub-selection by default
 # return if variable is time
 # Only use flag var for processing real variable

self
var
ruleArgs