Beispiel #1
0
 def mask_gripe(vec, mask):
    if (mask is not None and not vec.bounds_le(mask)):
       raise ValueError('mask is smaller than vector: [%s, %s] < [%s, %s]'
                        % (time_.iso8601_date(mask.first_day),
                           time_.iso8601_date(mask.last_day),
                           time_.iso8601_date(vec.first_day),
                           time_.iso8601_date(vec.last_day)))
Beispiel #2
0
 def mask_gripe(vec, mask):
     if (mask is not None and not vec.bounds_le(mask)):
         raise ValueError(
             'mask is smaller than vector: [%s, %s] < [%s, %s]' %
             (time_.iso8601_date(
                 mask.first_day), time_.iso8601_date(
                     mask.last_day), time_.iso8601_date(
                         vec.first_day), time_.iso8601_date(vec.last_day)))
Beispiel #3
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))
Beispiel #4
0
   def iso8601iter(self):
      '''Iterator which lists my days in ISO 8601 format. For example:

         >>> a = Date_Vector.zeros('2013-06-02', '2013-06-05')
         >>> a.iso8601iter
         <generator object iso8601iter at 0x...>
         >>> list(a.iso8601iter)
         ['2013-06-02', '2013-06-03', '2013-06-04', '2013-06-05']'''
      for d in time_.dateseq(self.first_day, self.last_day):
         yield time_.iso8601_date(d)
Beispiel #5
0
    def iso8601iter(self):
        '''Iterator which lists my days in ISO 8601 format. For example:

         >>> a = Date_Vector.zeros('2013-06-02', '2013-06-05')
         >>> a.iso8601iter
         <generator object iso8601iter at 0x...>
         >>> list(a.iso8601iter)
         ['2013-06-02', '2013-06-03', '2013-06-04', '2013-06-05']'''
        for d in time_.dateseq(self.first_day, self.last_day):
            yield time_.iso8601_date(d)
Beispiel #6
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))
Beispiel #7
0
 def __repr__(self):
    if (self._first_day is not None):
       datestr = "'" + time_.iso8601_date(self.first_day) + "'"
    else:
       datestr = 'None'
    return 'Date_Vector(%s, %s' % (datestr, np.ndarray.__repr__(self)[12:])
Beispiel #8
0
 def __repr__(self):
     if (self._first_day is not None):
         datestr = "'" + time_.iso8601_date(self.first_day) + "'"
     else:
         datestr = 'None'
     return 'Date_Vector(%s, %s' % (datestr, np.ndarray.__repr__(self)[12:])