Beispiel #1
0
 def _format_(self):
     if self.time_range is not None:
         self._format_time_range_()
     if self.time_region is not None:
         self._format_time_region_()
     if self.level_range is not None:
         self._format_level_range_()
     ## ensure the time range and region overlaps
     if not validate_time_subset(self.time_range,self.time_region):
         raise(DefinitionValidationError('dataset','time_range and time_region do not overlap'))
Beispiel #2
0
 def test_validate_time_subset(self):
     time_range = [dt(2000,1,1),dt(2001,1,1)]
     self.assertTrue(validate_time_subset(time_range,{'year':[2000,2001]}))
     self.assertFalse(validate_time_subset(time_range,{'year':[2000,2001,2002]}))
     self.assertTrue(validate_time_subset(time_range,{'month':[6,7,8]}))
     self.assertTrue(validate_time_subset(time_range,{'month':[6,7,8],'year':[2000]}))
     self.assertFalse(validate_time_subset(time_range,{'month':[6,7,8],'year':[2008]}))
     self.assertFalse(validate_time_subset([dt(2000,1,1),dt(2000,2,1)],{'month':[6,7,8],'year':[2008]}))
     self.assertTrue(validate_time_subset([dt(2000,1,1),dt(2000,2,1)],None))
Beispiel #3
0
 def test_validate_time_subset(self):
     time_range = [dt(2000,1,1),dt(2001,1,1)]
     self.assertTrue(validate_time_subset(time_range,{'year':[2000,2001]}))
     self.assertFalse(validate_time_subset(time_range,{'year':[2000,2001,2002]}))
     self.assertTrue(validate_time_subset(time_range,{'month':[6,7,8]}))
     self.assertTrue(validate_time_subset(time_range,{'month':[6,7,8],'year':[2000]}))
     self.assertFalse(validate_time_subset(time_range,{'month':[6,7,8],'year':[2008]}))
     self.assertFalse(validate_time_subset([dt(2000,1,1),dt(2000,2,1)],{'month':[6,7,8],'year':[2008]}))
     self.assertTrue(validate_time_subset([dt(2000,1,1),dt(2000,2,1)],None))
Beispiel #4
0
 def _format_(self):
     if self.time_range is not None:
         self._format_time_range_()
     if self.time_region is not None:
         self._format_time_region_()
     if self.level_range is not None:
         self._format_level_range_()
     ## ensure the time range and region overlaps
     if not validate_time_subset(self.time_range, self.time_region):
         raise (DefinitionValidationError(
             'dataset', 'time_range and time_region do not overlap'))
Beispiel #5
0
 def _validate_time_subset_(self):
     if not validate_time_subset(self.time_range, self.time_region):
         raise RequestValidationError("time_range/time_region", '"time_range" and "time_region" must overlap.')
Beispiel #6
0
 def _validate_time_subset_(self):
     if not validate_time_subset(self.time_range, self.time_region):
         raise RequestValidationError(
             "time_range/time_region",
             '"time_range" and "time_region" must overlap.')