Swarm-NG  1.1
swarm-query.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 # -*- coding: utf-8 *-*
3 ## @file swarm-query.py Command-line utility to examine BDB log file, for usage see @ref swarm-query
4 import sys
5 from os.path import dirname, realpath
6 sys.path.append(dirname(dirname(realpath(__file__))))
7 
8 from swarmng.query import *
9 from swarmng.range_type import *
10 import argparse
11 
12 MAX_RECORDS = 10000;
13 
14 def parse_cmd():
15  parser = argparse.ArgumentParser()
16  parser.add_argument("-d", "--database", help="Database filename", required = True)
17  parser.add_argument("-m", "--max-records", help="maximum number of records to process", default=MAX_RECORDS, type=int )
18  parser.add_argument("-s", "--system-range", help="Range of systems to display",type=RangeType(int),default=Range.universal());
19  parser.add_argument("-t", "--time-range", help="Range of time to display", type=RangeType(float), default=Range.universal())
20  parser.add_argument("-b", "--body-range", help="Range of bodies to display", type=RangeType(int), default=Range.universal())
21  parser.add_argument("-e", "--evt-id", help="The type of event to display (provide codes)",type=RangeType(int), default=Range.universal());
22  parser.add_argument("-k", "--keplerian", help="Keplerian output. The argument defines the type of coordinate system used", choices = Keplerian.choices)
23  parser.add_argument("--initial-conditions", action="store_true",default=False)
24  parser.add_argument("--final-conditions", action="store_true", default=False)
25 
26  args = parser.parse_args()
27  return args
28 
29 
30 
31 if __name__ == '__main__':
32  args = parse_cmd()
33  run_with_args(args)