diff --git a/sen2chain/cloud_mask.py b/sen2chain/cloud_mask.py index b161526cdde998960f75ef7d56c221c82924d5ed..26ed50b9a2df841425d2c748c8613b984979bd1f 100755 --- a/sen2chain/cloud_mask.py +++ b/sen2chain/cloud_mask.py @@ -458,7 +458,7 @@ def create_cloud_mask_v003( probability: int = 1, iterations: int = 5, ) -> None: - + """ Create cloud mask version cm003. This cloudmask uses a simple thresholding and dilatations over the 20m cloud_probability band from Sen2Cor. The diff --git a/sen2chain/config.py b/sen2chain/config.py index 4d3471d539c410797456660b5b2b934a22745e6e..1056549e83d47b1555383018ca63aa1f97cb280d 100644 --- a/sen2chain/config.py +++ b/sen2chain/config.py @@ -151,6 +151,7 @@ class Config: logging.error( "Make sure the path to the sen2cor Bashrc file is valid: {}".format(item) ) + raise ValueError("Invalid sen2cor Bashrc") def get(self, param: str) -> str: """Returns a parameter value. diff --git a/sen2chain/jobs.py b/sen2chain/jobs.py index 03d8325420373753b9c2163c7496684d27b453a0..a704373ddbce619dc2c2f0a913775ccf1de39ab6 100644 --- a/sen2chain/jobs.py +++ b/sen2chain/jobs.py @@ -43,7 +43,7 @@ class Jobs: Class to list and remove existing jobs. Returns a list of existing job and job status when instanciated. Usage: - >>> Jobs() + >>> Jobs() """ def __init__(self): @@ -117,13 +117,18 @@ class Jobs: class Job: - """ Class to create, edit, save and launch job routines. A job allows you to download L1C, process L2A, cloudmasks and radiometric indices at once, for 1 or more Tile. Jobs can be set in cron, and a logging option is available. - - :param jid: Job identifier. If identifier already exists, load job configuration. If it does not exist, creates a job with the default configuration. - :type jid: str - - Usage: - >>> Job(jid='abc') + """ + Class to create, edit, save and launch job routines. A job allows you to download L1C, process L2A, cloudmasks and radiometric indices at once, for 1 or more Tile. + Jobs can be set in cron, and a logging option is available. + + A job is made of : + - a configuration file, located in sen2chain_data/config/jobs/ + - a .py file if job is set in cron. This .py launches the run() command + + Job config file contains global job parameters and tasks. + A task only targets a single Tile, meaning if you want to download and process multiple tile products you need to have the equal number of task lines in your configuration file. + We recommend manually editing the configuration file if you plan to set up a job with multiple Tiles, as editing with the command line is only for 1 task at a time. + """ # logger.propagate = False @@ -641,7 +646,7 @@ class Job: clean_after: bool = False, ): """ - Runs job. Job needs to be saved first. + Runs job immediatly. Job needs to be saved first. Tasks are performed line by line. :param clean_before: When True, clean the library of every tile in tasks before launching job. diff --git a/sen2chain/products.py b/sen2chain/products.py index 6c36adb067f706948db358d7a2691e41c9228da8..b4aa734ab3fd71bd4addc993a6450851e6519f2f 100755 --- a/sen2chain/products.py +++ b/sen2chain/products.py @@ -1863,6 +1863,31 @@ class NewCloudMaskProduct: sen2chain_processing_version=sen2chain_processing_version, sen2cor_version=sen2cor_version, ) + +############################"""""" ICI !! + + def remove(self): ++ """ ++ Remove CM Product. ++ ++ """ ++ ++ if self.path.exists(): ++ if self.path.is_symlink(): ++ cm_path = os.readlink(str(self.path)) ++ path_xml = os.readlink(str(self._info_path)) ++ logger.info("Removing: {}".format(cm_path)) ++ shutil.rmtree(cm_path) ++ logger.info("Removing symlink: {}".format(self.path)) ++ self.path.unlink() ++ self.path_xml.unlink() ++ else: ++ os.remove(str(self.path)) ++ os.remove(str(self._info_path)) ++ logger.info("Removing: {}".format(self.path)) ++ else: ++ logger.info("CM product not on disk") + + class IndiceProduct: