Skip to content
Snippets Groups Projects
Commit c2244d1d authored by julie.mlls's avatar julie.mlls
Browse files

Integration de jpylyzer dans clean_lib pour detection des jp2 non valides

parent 95023e16
No related branches found
No related tags found
No related merge requests found
......@@ -21,6 +21,7 @@ from pprint import pformat
import multiprocessing
from queue import Queue
from threading import Thread
from jpylyzer import jpylyzer
# type annotations
from typing import List, Dict, Iterable
......@@ -1858,6 +1859,27 @@ class Tile:
)
f.unlink()
nb_rm += 1
# check jp2 validity
for key, sub_path in self._paths["indices"].items():
sub_path = Path(sub_path) # Convertit le chemin en objet Path
print(f"Exploration du dossier {key}: {sub_path}")
for jp2_file in sub_path.rglob("*.jp2"):
#print(f" - Fichier : {jp2_file}")
test_validity = jpylyzer.checkOneFile(jp2_file).findtext('isValid')
if test_validity == 'False':
txt = "Invalid jp2 {} (jpylyzer)".format(jp2_file.name)
prob_id.append(txt)
logger.info(txt)
nb_id += 1
if remove:
logger.info(
"Removing invalid jp2 {} from L2A folder".format(
jp2_file.name
)
)
jp2_file.unlink()
nb_rm += 1
# identify 0B or absent indice QL
"""
......
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