class TestService(unittest.TestCase): def setUp(self): config = StringIO("""[cassandra] host=127.0.0.1 keyspace=nexustiles local_datacenter=datacenter1 protocol_version=3 port=9042 [solr] host=http://localhost:8983 core=nexustiles [datastore] store=cassandra""") cp = ConfigParser.RawConfigParser() cp.readfp(config) self.tile_service = NexusTileService(config=cp) def test_get_distinct_bounding_boxes_in_polygon(self): boxes = self.tile_service.get_distinct_bounding_boxes_in_polygon(box(-180, -90, 180, 90), "MXLDEPTH_ECCO_version4_release1", 1, time.time()) for b in boxes: print b.bounds def test_get_distinct_bounding_boxes_in_polygon_mur(self): boxes = self.tile_service.get_distinct_bounding_boxes_in_polygon(box(-180, -90, 180, 90), "JPL-L4_GHRSST-SSTfnd-MUR-GLOB-v02.0-fv04.1", 1, time.time()) for b in boxes: print b.bounds def test_find_tiles_by_exact_bounds(self): tiles = self.tile_service.find_tiles_by_exact_bounds((175.01, -42.68, 180.0, -40.2), "JPL-L4_GHRSST-SSTfnd-MUR-GLOB-v02.0-fv04.1", 1, time.time()) for tile in tiles: print tile.get_summary() def test_sorted_box(self): tiles = self.tile_service.get_tiles_bounded_by_box(-42.68, -40.2, 175.01, 180.0, "JPL-L4_GHRSST-SSTfnd-MUR-GLOB-v02.0-fv04.1", 1, time.time()) for tile in tiles: print tile.min_time def test_time_series_tile(self): tiles = self.tile_service.find_tile_by_id("055c0b51-d0fb-3f39-b48a-4f762bf0c994") for tile in tiles: print tile.get_summary() def test_get_tiles_by_metadata(self): tiles = self.tile_service.get_tiles_by_metadata(['id:60758e00-5721-3a6e-bf57-78448bb0aeeb'], "MUR-JPL-L4-GLOB-v4.1", 1514764800, 1514764800) for tile in tiles: print tile.get_summary()
class TestLongitudeLatitudeMap(unittest.TestCase): def setUp(self): self.tile_service = NexusTileService() def test_lin_reg(self): LongitudeLatitudeMap.tile_service = self.tile_service print next( LongitudeLatitudeMap.regression_on_tiles( (175.01, -42.68, 180.0, -40.2), box(-180, -90, 180, 90).wkt, 1, time.time(), "JPL-L4_GHRSST-SSTfnd-MUR-GLOB-v02.0-fv04.1")) def test_lat_lon_map_driver_mur(self): # LongitudeLatitudeMap.tile_service = self.tile_service print next( iter( LongitudeLatitudeMap.lat_lon_map_driver( box(-180, -90, 180, 90), 1, time.time(), "JPL-L4_GHRSST-SSTfnd-MUR-GLOB-v02.0-fv04.1", [(175.01, -42.68, 180.0, -40.2)]))) def test_lat_lon_map_driver_ecco(self): bounding = box(-148, 38, -129, 53) ds = "MXLDEPTH_ECCO_version4_release1" start_seconds_from_epoch = 1 end_seconds_from_epoch = time.time() boxes = self.tile_service.get_distinct_bounding_boxes_in_polygon( bounding, ds, start_seconds_from_epoch, end_seconds_from_epoch) print LongitudeLatitudeMap.LongitudeLatitudeMapHandlerImpl.results_to_dicts( LongitudeLatitudeMap.lat_lon_map_driver( bounding, start_seconds_from_epoch, end_seconds_from_epoch, ds, [a_box.bounds for a_box in boxes]))
class TestService(unittest.TestCase): def setUp(self): config = StringIO("""[cassandra] host=127.0.0.1 keyspace=nexustiles local_datacenter=datacenter1 protocol_version=3 port=32769 [solr] host=localhost:8986 core=nexustiles""") cp = ConfigParser.RawConfigParser() cp.readfp(config) self.tile_service = NexusTileService(config=cp) def test_get_distinct_bounding_boxes_in_polygon(self): boxes = self.tile_service.get_distinct_bounding_boxes_in_polygon(box(-180, -90, 180, 90), "MXLDEPTH_ECCO_version4_release1", 1, time.time()) for b in boxes: print b.bounds def test_get_distinct_bounding_boxes_in_polygon_mur(self): boxes = self.tile_service.get_distinct_bounding_boxes_in_polygon(box(-180, -90, 180, 90), "JPL-L4_GHRSST-SSTfnd-MUR-GLOB-v02.0-fv04.1", 1, time.time()) for b in boxes: print b.bounds def test_find_tiles_by_exact_bounds(self): tiles = self.tile_service.find_tiles_by_exact_bounds((175.01, -42.68, 180.0, -40.2), "JPL-L4_GHRSST-SSTfnd-MUR-GLOB-v02.0-fv04.1", 1, time.time()) for tile in tiles: print tile.get_summary() def test_sorted_box(self): tiles = self.tile_service.get_tiles_bounded_by_box(-42.68, -40.2, 175.01, 180.0, "JPL-L4_GHRSST-SSTfnd-MUR-GLOB-v02.0-fv04.1", 1, time.time()) for tile in tiles: print tile.min_time