diff --git a/sen2chain/tiles.py b/sen2chain/tiles.py index 83993ec97b85927af3770f9dde11224d6cf131de..00a56553ce2d28b31894f013e66aa9fc2132ef00 100644 --- a/sen2chain/tiles.py +++ b/sen2chain/tiles.py @@ -976,7 +976,24 @@ class Tile: for indice in [val for sublist in [getattr(self, i) for i in [p for p in self.paths["indices"]]] for val in sublist]: IndiceProduct(identifier = indice.identifier) - + + def remove_l1c(self): + """ + Remove l1c files + """ + for product in self.l1c: + l1c = L1cProduct(product.identifier) + if l1c.path.is_symlink(): + l1c_path = os.readlink(str(l1c.path)) + logger.info("Removing: {}".format(l1c_path)) + shutil.rmtree(l1c_path) + logger.info("Removing symlink: {}".format(l1c.path)) + l1c.path.unlink() + else: + #~ l1c_path = os.readlink(str(l1c.path)) + logger.info("Removing: {}".format(l1c.path)) + shutil.rmtree(str(l1c.path)) + def remove_l2a(self): """ Remove l2a files