parameters: (options, outputFolder)
return_statement: return 1
docstring: Fetch all the nav data for a flight.
docstring_summary: Fetch all the nav data for a flight.
docstring_tokens: Fetch all the nav data for a flight .
function: def fetchNavData(options, outputFolder):
      '''Fetch all the nav data for a flight.'''
  
      success = False
  
      # The storage convention for these is very easy!
      # - A few dates have two files instead of one.
      folderUrl = getFolderUrl(options.yyyymmdd, options.year, options.month,
                               options.day, False,
                               options.site, options.type)
      filename  = 'sbet_' + options.yyyymmdd + '.out'
      filenameA = 'sbet_' + options.yyyymmdd + 'a.out'
      filenameB = 'sbet_' + options.yyyymmdd + 'b.out'
      
      # Check which urls are accurate for this file
      # This is not robust enough, as it can return good status even when the data is missing.
      # So comment it out. Rather fetch all files and check them later.
      #url = folderUrl + filename
      #if checkIfUrlExists(url):
      #    fileList = [filename]
      #else:
      #    fileList = [filenameA, filenameB]
      fileList = [filename, filenameA, filenameB]
      
      if options.refetchNav:
          cmd = "rm -f " + os.path.join(outputFolder, "sbet_*")
          print(cmd)
          os.system(cmd)
       
      # Download the files    
      for f in fileList:
          url        = os.path.join(folderUrl, f)
          outputPath = os.path.join(outputFolder, f)
          # TODO: How to handle refetch?
          if validateNavOrWipe(outputPath, logger):
              success = True
              continue
  
          # This times out, so avoid it
          #if not checkIfUrlExists(url):
          #    continue
          
          ans = icebridge_common.fetchFile(url, outputPath)
          if not ans:
              logger.info("Bad url: " + url)
              continue
          
          if validateNavOrWipe(outputPath, logger):
              success = True
              
      if success:
          return 0
      
      return 1
function_tokens: def fetchNavData ( options , outputFolder ) : success = False # The storage convention for these is very easy! # - A few dates have two files instead of one. folderUrl = getFolderUrl ( options . yyyymmdd , options . year , options . month , options . day , False , options . site , options . type ) filename = 'sbet_' + options . yyyymmdd + '.out' filenameA = 'sbet_' + options . yyyymmdd + 'a.out' filenameB = 'sbet_' + options . yyyymmdd + 'b.out' # Check which urls are accurate for this file # This is not robust enough, as it can return good status even when the data is missing. # So comment it out. Rather fetch all files and check them later. #url = folderUrl + filename #if checkIfUrlExists(url): #    fileList = [filename] #else: #    fileList = [filenameA, filenameB] fileList = [ filename , filenameA , filenameB ] if options . refetchNav : cmd = "rm -f " + os . path . join ( outputFolder , "sbet_*" ) print ( cmd ) os . system ( cmd ) # Download the files     for f in fileList : url = os . path . join ( folderUrl , f ) outputPath = os . path . join ( outputFolder , f ) # TODO: How to handle refetch? if validateNavOrWipe ( outputPath , logger ) : success = True continue # This times out, so avoid it #if not checkIfUrlExists(url): #    continue ans = icebridge_common . fetchFile ( url , outputPath ) if not ans : logger . info ( "Bad url: " + url ) continue if validateNavOrWipe ( outputPath , logger ) : success = True if success : return 0 return 1