Package helpers :: Module UpdateQualityFlags
[hide private]

Source Code for Module helpers.UpdateQualityFlags

 1  #! /usr/bin/env python 
 2  #------------------------------------------------------------------------------ 
 3  #$Id: UpdateQualityFlags.py 9703 2013-02-11 09:32:14Z RossCollins $ 
 4  """ 
 5     Fills the ppErrBits attribute of the detection tables. 
 6   
 7     @author: R.S. Collins 
 8     @org:    WFAU, IfA, University of Edinburgh 
 9  """ 
10  #------------------------------------------------------------------------------ 
11  from wsatools.CLI            import CLI 
12  from wsatools.Logger         import Logger 
13  from wsatools.QualityControl import QualityFlagUpdater 
14  #------------------------------------------------------------------------------ 
15  # Entry point for script. 
16   
17  # Allow module to be imported as well as executed from the command line 
18  if __name__ == "__main__": 
19      # Define additional command-line interface options for QualityFlagUpdater 
20   
21      CLI.progArgs.append(CLI.Argument("programmeID", "LAS")) 
22      CLI.progOpts += [ 
23        CLI.Option('b', "bit", 
24          "just do this bit", 
25          "NUMBER", isValOK=lambda x: x.isdigit() and int(x) < 32), 
26        CLI.Option('d', "deep_only", 
27          "Only flag deep detections (VVV-style tables only)"), 
28        CLI.Option('e', "end_date", 
29          "date of last monthly detection table to update e.g. 2004-04-01" 
30          " or 20040401 or P87", 
31          "DATE", isValOK=CLI.isDateOK), 
32        CLI.Option('f', "force", 
33          "Force run, even if mosaic provenance is incomplete")] 
34   
35      # Reset the default comment 
36      CLI.progArgs["comment"] = "Updating detection quality bit flags" 
37   
38      cli = CLI(QualityFlagUpdater, "$Revision: 9703 $") 
39      Logger.isVerbose = False 
40      Logger.addMessage(cli.getProgDetails()) 
41   
42      cu = QualityFlagUpdater(cli.getArg("programmeID"), cli=cli) 
43      try: 
44          cu.dateRange = cu.sysc.obsCal.dateRange(end=cli.getOpt("end_date")) 
45      except Exception as error: 
46          raise SystemExit("Illegal Option: " + str(error)) 
47   
48      cu.isDeepOnly = cli.getOpt("deep_only") 
49      cu.skipProvenanceCheck = cli.getOpt("force") 
50      if cli.getOpt("bit"): 
51          cu.doBit = int(cli.getOpt("bit")) 
52   
53      cu.run() 
54   
55  #------------------------------------------------------------------------------ 
56  # Change log: 
57  # 
58  # 20-Nov-2006,  RSC: Original version. 
59  # 26-Nov-2008,  RSC: Moved classes out of UpdateQualityFlags script into a new 
60  #                    QualityControl module. 
61