nappy/contrib/aircraft/scanFAAM.py
def scanFAAM(fileName=None, vars=None, nth=4, missingValuesToUse=(-9999., -32767.)):
    """
    Scans every 'nth' variable in the list of variables (or found in the
    file and gets the first and last index of the first (time) dimension
    that holds real (non-missing) values.
    """
    if type(missingValuesToUse)!=type((1,2)):
        missingValuesToUse=(missingValuesToUse,)
    startList=[]
    endList=[]
    start=None
    end=None

    if not fileName and not vars:
        raise "You must provide either a file name or a list of cdms variables."
    
    if fileName:
        f=cdms.open(fileName)
        vars=f.listvariables()

    for var in vars:
        if type(var)!=type(""):
            id=var.id
        else:
            id=var

        if id[-4:]=="FLAG" or id=="Time":
            continue

        if type(var)==type(""):
            var=f(var)

        step=1000
        while (start, end)==(None, None):
            (start, end)=findMissing(var, step, missingValuesToUse)
            step=step/2

        startList.append(start)
        endList.append(end)
        print "Start/End index: %s %s:%s" % (id, start, end)
  
    startMin=min(startList)
    endMax=max(endList)
    return (startMin, endMax)

    Scans every 'nth' variable in the list of variables (or found in the
    file and gets the first and last index of the first (time) dimension
    that holds real (non-missing) values.
    
Scans every 'nth' variable in the list of variables (or found in the
file and gets the first and last index of the first (time) dimension
that holds real (non-missing) values.
Scans every ' nth ' variable in the list of variables ( or found in the file and gets the first and last index of the first ( time ) dimension that holds real ( non - missing ) values .
def scanFAAM(fileName=None, vars=None, nth=4, missingValuesToUse=(-9999., -32767.)):
    if type(missingValuesToUse)!=type((1,2)):
        missingValuesToUse=(missingValuesToUse,)
    startList=[]
    endList=[]
    start=None
    end=None
    if not fileName and not vars:
        raise "You must provide either a file name or a list of cdms variables."
    if fileName:
        f=cdms.open(fileName)
        vars=f.listvariables()
    for var in vars:
        if type(var)!=type(""):
            id=var.id
        else:
            id=var
        if id[-4:]=="FLAG" or id=="Time":
            continue
        if type(var)==type(""):
            var=f(var)
        step=1000
        while (start, end)==(None, None):
            (start, end)=findMissing(var, step, missingValuesToUse)
            step=step/2
        startList.append(start)
        endList.append(end)
        print "Start/End index: %s %s:%s" % (id, start, end)
    startMin=min(startList)
    endMax=max(endList)
    return (startMin, endMax)
def scanFAAM ( fileName = None , vars = None , nth = 4 , missingValuesToUse = ( - 9999. , - 32767. ) ) : if type ( missingValuesToUse ) != type ( ( 1 , 2 ) ) : missingValuesToUse = ( missingValuesToUse , ) startList = [ ] endList = [ ] start = None end = None if not fileName and not vars : raise "You must provide either a file name or a list of cdms variables." if fileName : f = cdms . open ( fileName ) vars = f . listvariables ( ) for var in vars : if type ( var ) != type ( "" ) : id = var . id else : id = var if id [ - 4 : ] == "FLAG" or id == "Time" : continue if type ( var ) == type ( "" ) : var = f ( var ) step = 1000 while ( start , end ) == ( None , None ) : ( start , end ) = findMissing ( var , step , missingValuesToUse ) step = step / 2 startList . append ( start ) endList . append ( end ) print "Start/End index: %s %s:%s" % ( id , start , end ) startMin = min ( startList ) endMax = max ( endList ) return ( startMin , endMax )
Scans every 'nth' variable in the list of variables (or found in the
file and gets the first and last index of the first (time) dimension
that holds real (non-missing) values.
Scans every ' nth ' variable in the list of variables ( or found in the file and gets the first and last index of the first ( time ) dimension that holds real ( non - missing ) values .
"""
    Scans every 'nth' variable in the list of variables (or found in the
    file and gets the first and last index of the first (time) dimension
    that holds real (non-missing) values.
    """
fileName
vars
nth
missingValuesToUse