def testIntersecting(self): b = Box.fromDegrees(273.6, 30.7, 273.7180105379097, 30.722546655347717) c = Chunker(85, 12) self.assertEqual(c.getChunksIntersecting(b), [9630, 9631, 9797]) self.assertEqual(c.getSubChunksIntersecting(b), [(9630, [770]), (9631, [759]), (9797, [11])])
def testChunkBoundingBox(self): chunker = Chunker(200, 5) chunk_id = 3645 stripe = chunker.getStripe(chunk_id) chunk_in_stripe = chunker.getChunk(chunk_id, stripe) bbox = chunker.getChunkBoundingBox(stripe, chunk_in_stripe) sbbox = chunker.getSubChunkBoundingBox(0, 0) self.assertEqual(stripe, 9) self.assertEqual(chunk_in_stripe, 45) b = Box.fromRadians(5.048988193233824, -1.4294246573883558, 5.1611879309330035, -1.413716694110407) self.assertAlmostEqual(bbox, b) sb = Box.fromRadians(0.0, -1.5707963267948966, 6.283185307179586, -1.5676547341363067) self.assertAlmostEqual(sbbox, sb)
def testPickle(self): a = Chunker(85, 12) b = pickle.loads(pickle.dumps(a)) self.assertEqual(a, b)
def testString(self): chunker = Chunker(85, 12) self.assertEqual(str(chunker), 'Chunker(85, 12)') self.assertEqual(repr(chunker), 'Chunker(85, 12)') self.assertEqual(chunker, eval(repr(chunker), dict(Chunker=Chunker)))
def testComparisonOperators(self): c = Chunker(85, 12) self.assertEqual(c, c) self.assertEqual(c, Chunker(85, 12)) self.assertNotEqual(c, Chunker(85, 10))
def testConstruction(self): chunker = Chunker(85, 12) self.assertEqual(chunker.numStripes, 85) self.assertEqual(chunker.numSubStripesPerStripe, 12)