예제 #1
0
def main():
    """ the utility """
    print_center(UTILITY_TITLE, '-')
    try: 
        commands = csva.ArgClass(REQ_FLAGS, OPT_FLAGS, HELP_STRING)
    except RuntimeError, error_message:
        exit_on_failure(error_message[0])
예제 #2
0
def check_files(cmds, file_keys):
    """
        creates a list of files to plot
        
    arguments:
        cmds:       ((string)list)the list of command imputs
        file_keys:  ((string)list)the keys that might contain files
    
    returns: 
        a list of valid files
    """
    count = 0  
    files = []
    for key in file_keys:
        try:
            #~ if cmds[key] == "" and key != "--data_0":
                #~ continue
            if not (check_file(cmds[key])):
                print_center("ERROR: invalid data_file, " + cmds[key])
                exit_on_failure()
            else:
                count += 1
                files.append(cmds[key])
        except KeyError:
            if (count == 0) :
                raise KeyError, "no files indicated"
                #print_center("ERROR: no files indicated", '*')
                #print_center("use --data_0 as flag for a singal file")
                #exit_on_failure() 
            else:
                continue

    return files
예제 #3
0
def main():
    """ main function """
    print_center(UTILITY_TITLE, "-")
    
    try:
        commands = csva.ArgClass(FLAGS, (), HELP_STRING)
    except RuntimeError, (ErrorMessage):
         exit_on_failure(ErrorMessage[0])    
예제 #4
0
def main():
    """ the utility """
    print "<<<USE CRLink.py IT IS A NEWER VERSION OF THIS PROGRAM>>>"
    return
    print_center(UTILITY_TITLE, '-')
    try: 
        commands = csva.ArgClass(REQ_FLAGS, OPT_FLAGS, HELP_STRING)
    except RuntimeError, error_message:
        exit_on_failure(error_message[0])
예제 #5
0
def csv_plotter():
    """
    this is the csv plotter utility this functon acts like main
    """
    print_center(UTILITY_TITLE, '-')

    try: 
        commands = csva.ArgClass(REQ_FLAGS, OPT_FLAGS, HELP_STRING)
    except RuntimeError, error_message:
        exit_on_failure(error_message[0])
예제 #6
0
def get_ip():
    """
    gets the ip adderess from a file
    """

    print_center(UTILITY_TITLE, "-")
    try:
        inputs = csva.ArgClass(REQ_FLAGS, OPT_FLAGS, HELP)
    except RuntimeError, error_message:
        exit_on_failure(error_message[0])
예제 #7
0
def precip_check(p_dates, p_vals, at_dates, at_vals, interval, cutoff):
    """
        this function checks to see if preciptation values lie with in the given 
    date and temperature values. If they do they are written to a new array 
    as is: else bad_val is written
    
    arguments:
        p_dates:     ((datetime) list)precip date array
        p_vals:      ((float) list)precip value array
        at_dates:    ((datetime) list)air temerature date array
        at_vals:     ((float) list)air temerature value array
        start:       (datetime) the start date
        end:         (datetime) the end date
        cutoff:      (float) the cutoff temperature
    
    returns 
        an array of corrected precip values
    """
    bad_val = 6999
    o_val = []
    index = 0
    while (index < len(p_dates)):
        if not(p_dates[index] == at_dates[index]):
            print_center("dates do not match for precipitation and air temp"
                                                                          ,'*')
            exit_on_failure()
            # how to handle this?
        print p_dates[index], p_vals[index], at_dates[index], at_vals[index]
        date = p_dates[index].replace(year = 1004)
        if not(csvd.is_in_interval(date, interval)):
            o_val.insert(index, bad_val)
            
        elif (at_vals[index] < cutoff):
            o_val.insert(index, bad_val)
        else:
            o_val.insert(index, p_vals[index])
        index += 1

    return o_val
예제 #8
0
        

def main():
    """ the utility """
    print "<<<USE CRLink.py IT IS A NEWER VERSION OF THIS PROGRAM>>>"
    return
    print_center(UTILITY_TITLE, '-')
    try: 
        commands = csva.ArgClass(REQ_FLAGS, OPT_FLAGS, HELP_STRING)
    except RuntimeError, error_message:
        exit_on_failure(error_message[0])
        
    if commands.is_missing_flags():
        for items in commands.get_missing_flags():
            print_center(" ERROR: flag <" + items + "> is required ", "*")
        exit_on_failure()
    

    

    #~ if not commands:
#~ 
        #~ c = LoggerLink()
        #~ prompt(c)
    #~ else:  
    #~ if not ("--action" in commands.keys()):
        #~ print_center("Error: no action given", "*")
        #~ exit_on_failure() 
    if("--port" in commands.keys() and "--host" in commands.keys() ):
        c = LoggerLink(commands['--host'], commands["--port"])
    elif "--port" in commands.keys():