def test_get_file(self): d_start = date(2015, 6, 24) d_end = date(2016, 6, 24) bounding_box = (-115.927734375, 34.52466147177172, -78.31054687499999, 44.84029065139799) landsat_filters = LandsatQueryFilters() landsat_filters.acquired.set_range(d_start, True, d_end, True) landsat_filters.aoi.set_bounds(*bounding_box) metadata_service = MetadataService() rows = metadata_service.search(SpacecraftID.LANDSAT_8, data_filters=landsat_filters, limit=1) rows = list(rows) metadata = rows[0] landsat = Landsat(metadata) self.assertIsNotNone(landsat) vrt = landsat.get_vrt([4, 3, 2]) self.assertIsNotNone(vrt) dataset = landsat.get_dataset([4, 3, 2], DataType.UINT16) self.assertIsNotNone(dataset)
def test_vrt_not_pre(self): d_start = date(2017, 6, 24) d_end = date(2017, 9, 24) bounding_box = (-115.927734375, 34.52466147177172, -78.31054687499999, 44.84029065139799) # sql_filters = ['collection_number!="PRE"'] landsat_filter = LandsatQueryFilters() landsat_filter.collection_number.set_exclude_value("PRE") landsat_filter.acquired.set_range(d_start, True, d_end, True) landsat_filter.aoi.set_bounds(*bounding_box) rows = self.metadata_service.search(SpacecraftID.LANDSAT_8, limit=1, data_filters=landsat_filter) rows = list(rows) metadata = rows[0] landsat = Landsat(metadata) self.assertIsNotNone(landsat) vrt = landsat.get_vrt([4, 3, 2]) self.assertIsNotNone(vrt) dataset = landsat.get_dataset([4, 3, 2], DataType.UINT16) self.assertIsNotNone(dataset)