Package helpers :: Module ConvertEsoAdpFiles
[hide private]

Source Code for Module helpers.ConvertEsoAdpFiles

 1  #! /usr/bin/env python 
 2  #------------------------------------------------------------------------------ 
 3  # $Id: ConvertEsoAdpFiles.py 10246 2014-03-13 12:29:55Z NicholasCross $ 
 4  """ 
 5     Creates the FITS files necessary for the current ESO-SAF data release 
 6     requirements. These are currently copies of the deep tile images and 
 7     confidence maps; catalogues of these via detection table outgests; passband 
 8     merged source tables also via source table outgests and light curves from 
 9     a database query. 
10   
11     @author: R.S. Collins 
12     @org:    WFAU, IfA, University of Edinburgh 
13  """ 
14  #------------------------------------------------------------------------------ 
15  from __future__      import division, print_function 
16   
17  import os 
18  import time 
19   
20  from   wsatools.CLI                 import CLI 
21  from   wsatools.DbConnect.CuSession import CuSession 
22  from   wsatools.Logger              import Logger 
23  #------------------------------------------------------------------------------ 
24   
25 -class ConvertEsoAdpFiles(CuSession):
26 """ 27 """ 28 29 adpFileList = None 30
31 - def _onRun(self):
32 """ 33 """ 34 dateStr = time.strftime("%Y%m%d", time.gmtime()) 35 outputFileName = os.path.join("/disk47/sys/eso_adp_lists", "%s_%s.txt" % 36 (self.programme.getAcronym().upper(), dateStr)) 37 inputData = file(self.adpFileList).readlines() 38 outputLines = [] 39 readHeader = False 40 for line in inputData: 41 if len(line) < 5 or line.startswith('#'): 42 pass 43 elif not readHeader: 44 if line.startswith("Object"): 45 readHeader = True 46 else: 47 _object, origFile, arcFile = line[:-1].split(",") 48 outputLines.append("%s\t%s\n" % (origFile, arcFile)) 49 file(outputFileName, "w").writelines(outputLines)
50 51 52 #------------------------------------------------------------------------------ 53 54 if __name__ == "__main__": 55 # Command-line interface specification 56 CLI.progArgs += [ 57 CLI.Argument("programmeID", "VVV"), 58 CLI.Argument("adpFileList", 59 "/disk47/sys/eso_adp_lists/wdb_query_11233_eso.csv")] 60 61 cli = CLI(ConvertEsoAdpFiles, "$Revision: 10246 $") 62 Logger.isVerbose = False 63 Logger.addMessage(cli.getProgDetails()) 64 cu = ConvertEsoAdpFiles(cli.getArg("programmeID"), cli=cli) 65 cu.adpFileList = cli.getArg("adpFileList") 66 67 cu.run() 68