Example #1
0
def main(mockargs=None):  # pragma: no cover
    """Firelet command line interface"""

    opts, (a1, a2, a3, a4, a5, a6) = cli_args(mockargs=mockargs)

    whisper = say
    if opts.quiet:
        whisper = lambda x: None

    whisper("Firelet %s CLI." % __version__)

    if not a1:
        help()

    # read configuration,
    fn = opts.conffile.strip()
    fn = os.path.abspath(fn)
    if not os.path.isfile(fn):
        say("File %s not found" % fn)
        sys.exit(1)

    try:
        conf = ConfReader(fn=fn)
    except Exception, e:
        say("Exception %s while reading configuration file '%s'" % (e, fn))
        sys.exit(1)
Example #2
0
def main2(mockargs=None):    # pragma: no cover
    """Firelet command line interface"""

    opts, (a1, a2, a3, a4, a5, a6) = cli_args(mockargs=mockargs)

    whisper = say
    if opts.quiet:
        whisper = lambda x: None

    whisper( "Firelet %s CLI." % __version__)

    if not a1:
        help()

    # read configuration,
    try:
        fn=opts.conffile.strip()
        conf = ConfReader(fn=fn)
    except Exception, e:
        log.error("Exception %s while reading configuration file '%s'" % (e, fn))
        exit(1)
Example #3
0
     'stdev_dist': {'required': False, 'type': 'float', 'default': 1},
     'stdev_dist1': {'required': False, 'type': 'float', 'default': 1.5},
     'dimension': {'required': False, 'type': 'int', 'default': 3},
     'probability': {'required': False, 'type': 'float', 'default': 0.95},
     'blunders': {'required': False, 'type': 'int', 'default': 1},
     'ts_off': {'required': False, 'type': 'int', 'default': 0},
     'met': {'required': False, 'set': ['WEBMET', 'BMP180', 'SENSEHAT']},
     'met_addr': {'required': False},
     'met_par': {'required': False},
     '__comment__': {'required': False, 'type': 'str'}
 }
 # check command line param
 if len(sys.argv) > 1:
     if os.path.isfile(sys.argv[1]):
         try:
             cr = ConfReader('robotplus', sys.argv[1], config_pars)
             cr.Load()
         except:
             print("Error in config file: {0}".format(sys.argv[1]))
             sys.exit(-1)
         if not cr.Check():
             print("Config check failed")
             sys.exit(-1)
     else:
         print("Config file not found %s" % sys.argv[1])
         logging.fatal("Config file not found %s", sys.argv[1])
         sys.exit(-1)
 else:
     print("Missing parameter")
     print("Usage: robotplus.py config_file")
     sys.exit(-1)
Example #4
0
     },
     'blunders': {
         'required': False,
         'type': 'int',
         'default': 1
     },
     '__comment__': {
         'required': False,
         'type': 'str'
     }
 }
 # check command line param
 if len(sys.argv) > 1:
     if os.path.isfile(sys.argv[1]):
         try:
             cr = ConfReader('coords', sys.argv[1], None, config_pars)
             cr.Load()
         except:
             logging.fatal("Error in config file: " + sys.argv[1])
             sys.exit(-1)
         if not cr.Check():
             logging.fatal("Config check failed")
             sys.exit(-1)
     else:
         print("Config file not found " + sys.argv[1])
         logging.fatal("Config file not found " + sys.argv[1])
         sys.exit(-1)
 else:
     print("Usage: coords.py config_file")
     cr = ConfReader('coords',
                     '/home/siki/tanszek/szelkapu/szk1/szk1_all.json', None,
Example #5
0
     'wrt': {
         'required': False,
         'default': 'stdout'
     },
     '__comment__': {
         'required': False,
         'type': 'str'
     }
 }
 logging.getLogger().setLevel(logging.DEBUG)
 # process commandline parameters
 pat = re.compile(r'\.json$')
 #sys.argv.append('horiz.json')
 if len(sys.argv) == 2 and pat.search(sys.argv[1]):
     # load json config
     cr = ConfReader('HorizontalSection', sys.argv[1], None, config_pars)
     cr.Load()
     if not cr.Check():
         print("Config check failed")
         sys.exit(-1)
     logging.basicConfig(format=cr.json['log_format'],
                         filename=cr.json['log_file'],
                         filemode='a',
                         level=cr.json['log_level'])
     hz_start = None
     if cr.json['hz_start'] is not None:
         hz_start = Angle(float(cr.json['hz_start']), 'DEG')
     stepinterval = Angle(cr.json['angle_step'], 'DEG')
     stationtype = cr.json['station_type']
     port = cr.json['port']
     maxa = cr.json['max_angle'] / 180.0 * math.pi
Example #6
0
        },
        'plot_folder': {
            'required': False,
            'type': 'str',
            'default': "."
        },
        '__comment__': {
            'required': False,
            'type': 'str'
        }
    }
    # check command line param
    if len(sys.argv) > 1:
        if os.path.isfile(sys.argv[1]):
            try:
                cr = ConfReader('coords', sys.argv[1], None, config_pars)
                cr.Load()
            except:
                logging.fatal("Error in config file: " + sys.argv[1])
                sys.exit(-1)
            if not cr.Check():
                logging.fatal("Config check failed")
                sys.exit(-1)
        else:
            print("Config file not found " + sys.argv[1])
            logging.fatal("Config file not found " + sys.argv[1])
            sys.exit(-1)
    else:
        print("Usage: coord_plot.py config_file")
        sys.exit(-1)
Example #7
0
     'met_addr': {
         'required': False
     },
     'met_par': {
         'required': False
     },
     '__comment__': {
         'required': False,
         'type': 'str'
     }
 }
 # check command line param
 if len(sys.argv) > 1:
     if os.path.isfile(sys.argv[1]):
         try:
             cr = ConfReader('robotplus', sys.argv[1], None, config_pars)
             cr.Load()
         except:
             logging.error("Error in config file: " + sys.argv[1])
             sys.exit(-1)
         if not cr.Check():
             sys.exit(-1)
     else:
         print "Config file not found" + sys.argv[1]
         logging.error("Config file not found" + sys.argv[1])
 else:
     print "Usage: robotplus.py config_file"
     cr = ConfReader('robotplus', 'robotplus.json', None, config_pars)
     cr.Load()
     #sys.exit(-1)
 # logging