def test_create_subsets(self): self.assertEqual( TileGrid.create(4000, 3000, 500, 500, (-20., 10., 60., 70.), inv_y=True), TileGrid(4, 1, 1, 500, 375, (-20., 10., 60., 70.), inv_y=True)) self.assertEqual( TileGrid.create(4012, 3009, 500, 500, (-20., 10., 60., 70.), inv_y=True), TileGrid(2, 3, 5, 669, 301, (-20.0, 9.980059820538386, 60.03988035892323, 70.), inv_y=True)) self.assertEqual( TileGrid.create(4000, 3000, 500, 500, (170., 10., -160., 70.), inv_y=True), TileGrid(4, 1, 1, 500, 375, (170.0, 10.0, -160.0, 70.0), inv_y=True))
def test_create_cci_ecv(self): # 72, 8, 85, 17 # Soilmoisture CCI - daily L3S self.assertEqual( TileGrid.create(1440, 720, 500, 500, GLOBAL_GEO_EXTENT, inv_y=False), TileGrid(2, 2, 1, 360, 360, GLOBAL_GEO_EXTENT, inv_y=False)) # Aerosol CCI - monthly self.assertEqual( TileGrid.create(7200, 3600, 500, 500, GLOBAL_GEO_EXTENT, inv_y=False), TileGrid(4, 2, 1, 450, 450, GLOBAL_GEO_EXTENT, inv_y=False)) # Cloud CCI - monthly self.assertEqual( TileGrid.create(720, 360, 500, 500, GLOBAL_GEO_EXTENT, inv_y=True), TileGrid(1, 2, 1, 360, 360, GLOBAL_GEO_EXTENT, inv_y=True)) # SST CCI - daily L4 self.assertEqual( TileGrid.create(8640, 4320, 500, 500, GLOBAL_GEO_EXTENT, inv_y=True), TileGrid(4, 2, 1, 540, 540, GLOBAL_GEO_EXTENT, inv_y=True)) # Land Cover CCI self.assertEqual( TileGrid.create(129600, 64800, 500, 500, GLOBAL_GEO_EXTENT, inv_y=False), TileGrid(6, 6, 3, 675, 675, GLOBAL_GEO_EXTENT, inv_y=False))
def test_create_cci_ecv(self): # 72, 8, 85, 17 # Soilmoisture CCI - daily L3S self.assertEqual( TileGrid.create(1440, 720, 500, 500, POS_Y_AXIS_GLOBAL_RECT), TileGrid(2, 2, 1, 360, 360, POS_Y_AXIS_GLOBAL_RECT)) # Aerosol CCI - monthly self.assertEqual( TileGrid.create(7200, 3600, 500, 500, POS_Y_AXIS_GLOBAL_RECT), TileGrid(4, 2, 1, 450, 450, POS_Y_AXIS_GLOBAL_RECT)) # Cloud CCI - monthly self.assertEqual( TileGrid.create(720, 360, 500, 500, NEG_Y_AXIS_GLOBAL_RECT), TileGrid(1, 2, 1, 360, 360, NEG_Y_AXIS_GLOBAL_RECT)) # SST CCI - daily L4 self.assertEqual( TileGrid.create(8640, 4320, 500, 500, NEG_Y_AXIS_GLOBAL_RECT), TileGrid(4, 2, 1, 540, 540, NEG_Y_AXIS_GLOBAL_RECT)) # Land Cover CCI self.assertEqual( TileGrid.create(129600, 64800, 500, 500, POS_Y_AXIS_GLOBAL_RECT), TileGrid(6, 6, 3, 675, 675, POS_Y_AXIS_GLOBAL_RECT))
def test_create_illegal_geo_extent(self): # legal - explains why the next must fail self.assertEqual( TileGrid.create(50, 25, 5, 5, (0.0, 77.5, 25.0, 90.0), inv_y=True), TileGrid(2, 5, 2, 5, 7, (0.0, 76.0, 25.0, 90.0), inv_y=True)) with self.assertRaises(ValueError): TileGrid.create(50, 25, 5, 5, (0.0, 77.5, 25.0, 90.0), inv_y=False) # legal - explains why the next must fail self.assertEqual( TileGrid.create(50, 25, 5, 5, (0., -90.0, 25., -77.5), inv_y=False), TileGrid(2, 5, 2, 5, 7, (0.0, -90.0, 25.0, -76.0), inv_y=False)) with self.assertRaises(ValueError): TileGrid.create(50, 25, 5, 5, (0., -90.0, 25., -77.5), inv_y=True)
def test_create_cci_ecv_subsets(self): # Soilmoisture CCI - daily L3S - use case #6 self.assertEqual(TileGrid.create(52, 36, 500, 500, (72, 8, 85, 17)), TileGrid(1, 1, 1, 52, 36, (72., 8., 85., 17.)))