Exemplo n.º 1
0
Arquivo: ui.py Projeto: almccon/DYCAST
    def run_export_risk(self):
        self.status_label["text"] = "Status: exporting risk..."        
        self.status_label.update_idletasks()
        self.export_risk_button["state"] = DISABLED

        (curdate, enddate) = self.get_date_range(
            self.export_risk_entry1.get(),
            self.export_risk_entry2.get()
        )

        oneday = datetime.timedelta(days=1)

        while (curdate <= enddate):
            self.status_label["text"] = "Status: exporting risk... %s" % curdate
            self.status_label.update_idletasks()
            self.export_dir = self.export_dir_entry.get()
            try:
                dycast.export_risk(curdate, "dbf", self.export_dir)
            except Exception, inst:
                tkMessageBox.showwarning(
                    "Export risk",
                    "Could not export daily risk for %s: %s" % (curdate, inst)
                )
                break
            curdate = curdate + oneday
Exemplo n.º 2
0
    def run_export_risk(self):
        self.status_label["text"] = "Status: exporting risk..."
        self.status_label.update_idletasks()
        self.export_risk_button["state"] = DISABLED

        (curdate, enddate) = self.get_date_range(self.export_risk_entry1.get(),
                                                 self.export_risk_entry2.get())

        oneday = datetime.timedelta(days=1)

        while (curdate <= enddate):
            self.status_label[
                "text"] = "Status: exporting risk... %s" % curdate
            self.status_label.update_idletasks()
            self.export_dir = self.export_dir_entry.get()
            try:
                dycast.export_risk(curdate, "dbf", self.export_dir)
            except Exception, inst:
                tkMessageBox.showwarning(
                    "Export risk",
                    "Could not export daily risk for %s: %s" % (curdate, inst))
                break
            curdate = curdate + oneday
Exemplo n.º 3
0
  cs = default_cs
if options.closetime:
  ct = options.closetime
else:
  ct = default_ct
if options.spatialdomain:
  sd = options.spatialdomain
else:
  sd = default_sd
if options.temporaldomain:
  td = options.temporaldomain
else:
  td = default_td

i = int(options.num_days)

cur_date = datetime.date.today()
oneday = datetime.timedelta(days=1)

if cur_date.weekday() == calendar.FRIDAY:
    dycast.backup_birds()

dycast.download_birds() # All options set in config file
dycast.load_bird_file() # All options set in config file 
while i > 0:
    dycast.daily_risk(cur_date, cs, ct, sd, td) # this just needs to know date, and the parameters to use
    dycast.export_risk(cur_date) # needs to know date; use default directory
    dycast.upload_new_risk() # upload everything from default directory
    cur_date -= oneday  # back up one day
    i -= 1              # number of times remaining to back up
Exemplo n.º 4
0
            metavar="FILE")

options, arguments = p.parse_args()

config_file = options.config

dycast.read_config(config_file)

dycast.init_db()


riskdate = arguments[0]

if riskdate == "today" or not riskdate:
    riskdate = datetime.date.today()
else:
    try:
        # This very simple parsing will work fine if date is YYYY-MM-DD
        (y, m, d) = riskdate.split('-')
        riskdate = datetime.date(int(y), int(m), int(d))
    except Exception, inst:
        print "couldn't parse", riskdate
        print inst
        sys.exit()

if options.txt:
    dycast.export_risk(riskdate, "txt")
else:
    dycast.export_risk(riskdate, "dbf")

Exemplo n.º 5
0
             default="./dycast.config",
             help="load config file FILE",
             metavar="FILE")

options, arguments = p.parse_args()

config_file = options.config

dycast.read_config(config_file)

dycast.init_db()

riskdate = arguments[0]

if riskdate == "today" or not riskdate:
    riskdate = datetime.date.today()
else:
    try:
        # This very simple parsing will work fine if date is YYYY-MM-DD
        (y, m, d) = riskdate.split('-')
        riskdate = datetime.date(int(y), int(m), int(d))
    except Exception, inst:
        print "couldn't parse", riskdate
        print inst
        sys.exit()

if options.txt:
    dycast.export_risk(riskdate, "txt")
else:
    dycast.export_risk(riskdate, "dbf")