def month_resolver(self, start_mth, start_yr, end_mth, end_yr, dbname_template): """Month list """ if self.include_times: months = {} else: months = [] vol_month = start_mth vol_year = start_yr while vol_year <= end_yr or (vol_year == end_yr and vol_month <= end_mth): voltime = antstock.str2epoch("%d/1/%d" % (vol_month, vol_year)) if vol_month < 12: vol_month += 1 else: vol_month = 1 vol_year += 1 volendtime = antstock.str2epoch("%d/1/%d" % (vol_month,vol_year)) - 1 dbname = antstock.epoch2str(int(voltime), dbname_template) if os.path.exists(dbname) and os.path.isfile(dbname): if self.include_times: months[dbname] = (voltime,volendtime) else: months.append(dbname) else: if not legacy: antelog.elog_notify("%s %s *notify*: Dbpath '%s' does not exist." % (self.errstr, self.base, dbname)) else: antstock.elog_notify("%s %s *notify*: Dbpath '%s' does not exist." % (self.errstr, self.base, dbname)) return months
def year_resolver(self, start_yr, end_yr, dbname_template): """Year list """ if self.include_times: years = {} else: years = [] for y in range(start_yr, end_yr + 1): voltime = antstock.str2epoch("1/1/%s 00:00:00" % y) volendtime = antstock.str2epoch("12/31/%s 23:59:59" % y) dbname = antstock.epoch2str(voltime, dbname_template) if os.path.exists(dbname) and os.path.isfile(dbname): if self.include_times: years[dbname] = (voltime,volendtime) else: years.append(dbname) else: if not legacy: antelog.elog_notify("%s %s *notify*: Dbpath '%s' does not exist." % (self.errstr, self.base, dbname)) else: antstock.elog_notify("%s %s *notify*: Dbpath '%s' does not exist." % (self.errstr, self.base, dbname)) return years
def day_resolver(self, start_dy, end_dy, dbname_template): """Day list """ if self.include_times: days = {} else: days = [] while start_dy <= end_dy: voltime = antstock.epoch(start_day) volendtime = voltime + 86399 # one second less than a full day dbname = antstock.epoch2str(voltime, dbname_template) if os.path.exists(dbname) and os.path.isfile(dbname): if self.include_times: days[dbname] = (voltime, volendtime) else: days.append(dbname) else: if not legacy: antelog.elog_notify("%s %s *notify*: Dbpath '%s' does not exist." % (self.errstr, self.base, dbname)) else: antstock.elog_notify("%s %s *notify*: Dbpath '%s' does not exist." % (self.errstr, self.base, dbname)) start_dy = yearday((antstock.epoch(start_dy) + 86400)) return days