Exemplo n.º 1
0
def checkfitsfile(infile, frange, klist):

    #make sure the file exists
    if not os.path.isfile(infile): return False
 
    #expeand klist
    finstr, fstart, fstop, keyitems=klist

    #check that the file is of the right instrument and date
    if not infile.count(finstr): return False

    #check that the files are in the appropriate range
    try:
       nid=saltstring.filenumber(infile, -9, -5)
    except Exception, e:
       return False
Exemplo n.º 2
0
def checkfordata(rawpath, prefix, obsdate, log):
   """Check to see if the data have downloaded correctly"""
   lastnum=1
   saltio.fileexists(rawpath+'disk.file')
   content = saltio.openascii(rawpath+'disk.file','r')
   for line in content:
       lastnum = saltstring.filenumber(line)
   saltio.closeascii(content)
   lastfile = saltstring.filename(prefix,obsdate,lastnum-1)

   if lastnum==1: return lastnum

   #check to see that the data are present
   if (os.path.isfile(rawpath+lastfile) or os.path.isfile(rawpath+lastfile.replace('fits','bin'))):
       message  = 'Data download complete for %s\n' % rawpath
       log.message(message)
   else:
       message  = 'Data download incomplete to %s' % rawpath
       log.error(message)

   return lastnum