diff --git a/sen2chain/tiles.py b/sen2chain/tiles.py index 382c1b1939f41b6c09c316d8566160372f73d5f8..157eb2904c5d0cd85f981efdcf30d6568a1833fd 100644 --- a/sen2chain/tiles.py +++ b/sen2chain/tiles.py @@ -887,19 +887,22 @@ class Tile: And remove previous ones """ p = self.l2a.last.identifier - l2a = L2aProduct(p) - - outfullpath = l2a.path.parent / "QL" / (l2a.tile + '_' + p[0:4] + Tile._get_date(p).strftime("%Y%m%d") + '_QL_latest.jpg') - outfullpath.parent.mkdir(parents=True, exist_ok=True) - old_ql = list((l2a.path.parent / "QL").glob('*_QL_latest.jpg*')) - liste=[a for a in old_ql if str(outfullpath) not in str(a)] - for f in liste: - f.unlink() - if outfullpath in old_ql: - logger.info("{} - Latest QL already done".format(self.name)) - return + if p: + l2a = L2aProduct(p) + + outfullpath = l2a.path.parent / "QL" / (l2a.tile + '_' + p[0:4] + Tile._get_date(p).strftime("%Y%m%d") + '_QL_latest.jpg') + outfullpath.parent.mkdir(parents=True, exist_ok=True) + old_ql = list((l2a.path.parent / "QL").glob('*_QL_latest.jpg*')) + liste=[a for a in old_ql if str(outfullpath) not in str(a)] + for f in liste: + f.unlink() + if outfullpath in old_ql: + logger.info("{} - Latest QL already done".format(self.name)) + return + else: + l2a.process_ql(out_path = outfullpath, out_resolution=(750,750), jpg = True) else: - l2a.process_ql(out_path = outfullpath, out_resolution=(750,750), jpg = True) + logger.info("No L2A product available") def move_old_quicklooks(self): """