diff --git a/sen2chain/multi_processing.py b/sen2chain/multi_processing.py index 17c9cf474877e794d475d8a72d1385d6df3331cb..f33b580635b3ea49e391a08f838954345e8f27a1 100644 --- a/sen2chain/multi_processing.py +++ b/sen2chain/multi_processing.py @@ -95,7 +95,7 @@ def multi_cld_ver_pro_iter_repro(l2a_ver_pro_iter_repro): reprocess = l2a_ver_pro_iter_repro[8] try: l2a.compute_cloud_mask( - cm_version=cm_version.lower(), + cm_version=cm_version, probability=probability, iterations=iterations, cld_shad=cld_shad, @@ -140,7 +140,7 @@ def multi_idx(l2a_id_idx): reprocess=reprocess, nodata_clouds=nodata_clouds, quicklook=quicklook, - cm_version=cm_version.lower(), + cm_version=cm_version, probability=probability, iterations=iterations, cld_shad=cld_shad, diff --git a/sen2chain/products.py b/sen2chain/products.py index 8c0c67377904cdb22f9f8140f68cc9fdc8c6ad6a..d63de43458f0d77d31e03765322fe440230bc3cf 100755 --- a/sen2chain/products.py +++ b/sen2chain/products.py @@ -636,6 +636,7 @@ class L2aProduct(Product): # out_path_mask_b11 = None ) -> "L2aProduct": """ """ + cm_version = cm_version.upper() if cm_version == "CM003": logger.info( "Computing cloudmask version {}, probability {}%, iteration(s) {}: {}".format( diff --git a/sen2chain/tiles.py b/sen2chain/tiles.py index 51361c8ffb57ebf3cc1ae4e70604c42933b1cecd..e8b5e224e53116bf382f7a3caa847bb9cbaa5561 100644 --- a/sen2chain/tiles.py +++ b/sen2chain/tiles.py @@ -227,7 +227,7 @@ class CloudMaskList(ProductsList): """Class for managing mask product list""" @property - def cm001(self) -> "CloudMaskList": + def CM001(self) -> "CloudMaskList": filtered = CloudMaskList() for k, v in self._dict.items(): if "_CM001" in k: @@ -238,7 +238,7 @@ class CloudMaskList(ProductsList): return filtered @property - def cm002(self) -> "CloudMaskList": + def CM002(self) -> "CloudMaskList": filtered = CloudMaskList() for k, v in self._dict.items(): if "_CM002" in k: @@ -249,7 +249,7 @@ class CloudMaskList(ProductsList): return filtered @property - def cm003(self) -> "CloudMaskList": + def CM003(self) -> "CloudMaskList": filtered = CloudMaskList() for k, v in self._dict.items(): if "_CM003" in k: @@ -260,7 +260,7 @@ class CloudMaskList(ProductsList): return filtered @property - def cm004(self) -> "CloudMaskList": + def CM004(self) -> "CloudMaskList": filtered = CloudMaskList() for k, v in self._dict.items(): if "_CM004" in k: @@ -675,7 +675,7 @@ class Tile: return prod_list # def cloudmasks_missing(self, - # cm_version: str = "cm001", + # cm_version: str = "CM001", # probability: int = 1, # iterations: int = 5, # cld_shad: bool = True, @@ -687,7 +687,7 @@ class Tile: def cloudmasks_missing( self, - cm_version: str = "cm001", + cm_version: str = "CM001", probability: int = 1, iterations: int = 5, cld_shad: bool = True, @@ -769,7 +769,7 @@ class Tile: self, indice: str, nodata_clouds: bool = False, - cm_version: list = "cm001", + cm_version: list = "CM001", probability: int = 1, iterations: int = 5, cld_shad: bool = True, @@ -1002,7 +1002,7 @@ class Tile: def compute_cloudmasks( self, - cm_version: str = "cm001", + cm_version: str = "CM001", probability: int = 1, iterations: int = 5, cld_shad: bool = True, @@ -1016,11 +1016,11 @@ class Tile: ): """Compute all (missing) cloud masks for l2a products. - :param cm_version: version of cloudmask to compute. Can be either cm001, - cm002, cm003, or cm004. - :param probability: only used by cm003: threshold probability of clouds + :param cm_version: version of cloudmask to compute. Can be either CM001, + CM002, CM003, or CM004. + :param probability: only used by CM003: threshold probability of clouds to be considered. - :param iterations: only used by cm003: number of iterations for + :param iterations: only used by CM003: number of iterations for dilatation process while computing cloudmask. :param reprocess: if False (default), only missing cloudmasks will be computed. if True already processed cloudmask will be computed again. @@ -1031,7 +1031,8 @@ class Tile: :param nb_proc: number of parallel process, limited to the number of proc of your PC (default 4). """ - + + cm_version = cm_version.upper() if not reprocess: cld_l2a_process_list = list( [ @@ -1074,7 +1075,7 @@ class Tile: ) if cld_l2a_process_list: logger.info( - "{} l2a products to process:".format(len(cld_l2a_process_list)) + "{} l2a product(s) to process".format(len(cld_l2a_process_list)) ) # logger.info("{}".format(cld_l2a_process_list)) cld_version_probability_iterations_reprocessing_multiprocessing( @@ -1090,7 +1091,7 @@ class Tile: reprocess: bool = False, nodata_clouds: bool = True, quicklook: bool = False, - cm_version: list = "cm001", + cm_version: list = "CM001", probability: int = 1, iterations: int = 5, cld_shad: bool = True, @@ -1107,6 +1108,8 @@ class Tile: - if indices not provided, will compute missing dates of already existing indices for this tile (no new indice computed) - indices won't be masked if no cloud masks are present, you have to compute cloudmasks first """ + + cm_version = cm_version.upper() if not indices: indices = list(self._paths["indices"].keys()) # else: @@ -1615,7 +1618,7 @@ class Tile: """ Rename old indices to match new cloudmask nomenclature """ - # Rename old indices to default cm_version cm001 + # Rename old indices to default cm_version CM001 logger.info("Moving and renaming old indices") for indice, path in self._paths["indices"].items():