示例#1
0
 def set_interval(self, start, end):
     """
         set the interval for plotting
     
     arguments:
         start:      (string| datetime) the start date
         end:        (string| datetime) the end date
     """
     self.interval = csvd.make_interval(start, end)
示例#2
0
 def __init__(self, file_names, png = "def.png"):
     """
         this fucntion sets up the plot class
     
     arguments:
         file_names:     ((string)list) list of the filenames
         png:            (string) name of file to save the plot to
     """
     self.plot_files = {}
     for files in file_names:
         try:
             self.plot_files[files] = csvf.CsvFile(files, True)
             temp_key = files
         except IOError:
             exc_str = "' cannot be plotted as it does not exist."
             raise IOError, "The file  '" + files + exc_str 
     self.interval = csvd.make_interval("min","max")
     self.y_label = self.plot_files[temp_key].get_header()[-2][1]
     self.x_label = ""
     self.title = self.plot_files[temp_key].get_header()[0][0]
     self.set_up_plot()
     self.plots = []
     self.save_name = png
示例#3
0
    if commands.is_missing_flags():
        for items in commands.get_missing_flags():
            print_center(" ERROR: flag <" + items + "> is required ", "*")
        exit_on_failure()

    try:
        at_file = csvf.CsvFile(commands["--at_file"], True)
        p_in_file = csvf.CsvFile(commands["--precip_infile"], True)
    except IOError:
        print_center("ERROR: a required file was not found", '*')
        exit_on_failure()

    cutoff = commands.get_command_value("--cutoff", get_cutoff)
    interval = csvd.make_interval(
                    commands.get_command_value("--startdate" , start_date), 
                    commands.get_command_value("--enddate" , end_date))
    print interval
    p_in_file[1] = precip_check(p_in_file[0], p_in_file[1], at_file[0], 
                                        at_file[1], interval, cutoff)
    
    
    if not p_in_file.append(commands["--precip_outfile"]):
        print_center("Old dates indcate no new data to be appended.") 
        print_center("No data was written.                         ")  

    exit_on_success()
 

if __name__ == "__main__":
    main()