示例#1
0
 def open_month(self, month):
     if (month.day != 1):
         raise ValueError('must have day=1, not %d' % month.day)
     if (hasattr(month, 'hour')
             and (month.hour != 0 or month.minute != 0 or month.second != 0
                  or month.microsecond != 0)):
         raise ValueError('must have all sub-day attributes equal to zero')
     return self.group_get(time_.iso8601_date(month),
                           time_.hours_in_month(month))
示例#2
0
文件: timeseries.py 项目: reidpr/quac
 def open_month(self, month):
    if (month.day != 1):
       raise ValueError('must have day=1, not %d' % month.day)
    if (hasattr(month, 'hour') and (   month.hour != 0
                                    or month.minute != 0
                                    or month.second != 0
                                    or month.microsecond != 0)):
       raise ValueError('must have all sub-day attributes equal to zero')
    return self.group_get(time_.iso8601_date(month),
                          time_.hours_in_month(month))
示例#3
0
文件: timeseries.py 项目: reidpr/quac
 def caches_reset(self):
    'Reset all the caches associated with the groups.'
    # Pull the fragment tags from the filesystem, not self.groups, because
    # some groups may not be open.
    self.fragment_tags = list()
    for gf in sorted(glob.iglob('%s/*.db' % self.filename)):
       self.fragment_tags.append(os.path.split(os.path.splitext(gf)[0])[1])
    # Compute the length from the fragment tags, assuming they are months.
    # If they aren't, this will fail. The obvious thing to do then is open
    # each group and query it for length, but that's a bad idea because we
    # do not want to open groups unless we really need to interact with
    # them. Parallel writes to different groups depend on this.
    self.length = sum(time_.hours_in_month(time_.iso8601_parse(f))
                      for f in self.fragment_tags)
示例#4
0
 def caches_reset(self):
     'Reset all the caches associated with the groups.'
     # Pull the fragment tags from the filesystem, not self.groups, because
     # some groups may not be open.
     self.fragment_tags = list()
     for gf in sorted(glob.iglob('%s/*.db' % self.filename)):
         self.fragment_tags.append(
             os.path.split(os.path.splitext(gf)[0])[1])
     # Compute the length from the fragment tags, assuming they are months.
     # If they aren't, this will fail. The obvious thing to do then is open
     # each group and query it for length, but that's a bad idea because we
     # do not want to open groups unless we really need to interact with
     # them. Parallel writes to different groups depend on this.
     self.length = sum(
         time_.hours_in_month(time_.iso8601_parse(f))
         for f in self.fragment_tags)