Skip to content
Snippets Groups Projects
Commit 73423246 authored by pascal.mouquet_ird.fr's avatar pascal.mouquet_ird.fr
Browse files

new remove_l2a() function to remove all tile's l2a products from l2a and archive folders

parent d0f76e7e
No related branches found
No related tags found
No related merge requests found
Pipeline #32 canceled
...@@ -10,6 +10,7 @@ import fiona ...@@ -10,6 +10,7 @@ import fiona
import shutil import shutil
from PIL import Image from PIL import Image
import distutils import distutils
import os
from pathlib import Path from pathlib import Path
from collections import namedtuple from collections import namedtuple
...@@ -976,5 +977,15 @@ class Tile: ...@@ -976,5 +977,15 @@ 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]: 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) IndiceProduct(identifier = indice.identifier)
def remove_l2a(self):
"""
Remove l2a files
"""
for product in self.l2a:
l2a = L2aProduct(product.identifier)
if l2a.path.is_symlink():
l2a_path = os.readlink(str(l2a.path))
logger.info("Removing: {}".format(l2a_path))
shutil.rmtree(l2a_path)
logger.info("Removing symlink: {}".format(l2a.path))
l2a.path.unlink()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment