diff --git a/sen2chain/data/eodag.yml b/sen2chain/data/eodag.yml new file mode 100644 index 0000000000000000000000000000000000000000..46df0d4b852219543cfbf999ab5bd76ab6703edc --- /dev/null +++ b/sen2chain/data/eodag.yml @@ -0,0 +1,98 @@ +# -*- coding: utf-8 -*- +# Copyright 2021, CS GROUP - France, http://www.c-s.fr +# +# This file is part of EODAG project +# https://www.github.com/CS-SI/EODAG +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +peps: + priority: # Lower value means lower priority (Default: 1) + search: # Search parameters configuration + download: + extract: # whether to extract the downloaded products (true or false). + outputs_prefix: # where to store downloaded products. + dl_url_params: # additional parameters to pass over to the download url as an url parameter + auth: + credentials: + username: + password: +theia: + priority: # Lower value means lower priority (Default: 0) + search: # Search parameters configuration + download: + extract: + outputs_prefix: + dl_url_params: + auth: + credentials: + ident: + pass: +usgs: + priority: # Lower value means lower priority (Default: 0) + api: + extract: + outputs_prefix: + dl_url_params: + product_location_scheme: + credentials: + username: + password: +aws_eos: + priority: # Lower value means lower priority (Default: 0) + search: # Search parameters configuration + auth: + credentials: + apikey: + aws_access_key_id: + aws_secret_access_key: + download: + outputs_prefix: +sobloo: + priority: # Lower value means lower priority (Default: 0) + search: # Search parameters configuration + download: + extract: + outputs_prefix: + dl_url_params: + auth: + credentials: + apikey: +creodias: + priority: # Lower value means lower priority (Default: 0) + search: # Search parameters configuration + download: + extract: + outputs_prefix: + auth: + credentials: + username: + password: +mundi: + priority: # Lower value means lower priority (Default: 0) + search: # Search parameters configuration + download: + extract: + outputs_prefix: + auth: + credentials: + apikey: +onda: + priority: # Lower value means lower priority (Default: 0) + search: # Search parameters configuration + download: + extract: + outputs_prefix: + auth: + credentials: + username: + password: diff --git a/sen2chain/data/job_ini.cfg b/sen2chain/data/job_ini.cfg index 098895841a09ddc8de791cdf1edcf0eec70a987e..6ef215a872d5e022c78b317568ac22a4521481e2 100644 --- a/sen2chain/data/job_ini.cfg +++ b/sen2chain/data/job_ini.cfg @@ -6,7 +6,8 @@ # l2a: compute l2a with sen2chain: True | False # cloudmasks: False | CM001 | CM002 | CM003-PRB1-ITER5 | CM004-CSH1-CMP1-CHP1-TCI1-ITER0 # indices: False | All | NDVI/NDWIGAO/etc. +# remove: False | l1c/l2a logs = False timing = 0 0 * * * -tile;date_min;date_max;max_clouds;l1c;l2a;cloudmask;indices +tile;date_min;date_max;max_clouds;l1c;l2a;cloudmask;indices;remove diff --git a/sen2chain/jobs.py b/sen2chain/jobs.py index 7b835a50b3f2ecc472f3449fe3f536238d8961e5..dfc10b7725690b202ad340bc1754bd1070078a17 100644 --- a/sen2chain/jobs.py +++ b/sen2chain/jobs.py @@ -125,7 +125,7 @@ class Job(): ("l2a", [False]), ("cloudmask", [False]), ("indices", [False]), - #~ ("logs", [False]), + ("remove", [False]), ]) self.tasks = pd.DataFrame(first_row) @@ -141,7 +141,7 @@ class Job(): "l2a": [False], "cloudmask": [False], "indices": [False], - #~ "logs": [False], + "remove": [False], }) #~ self.tasks = self.tasks.append(row, ignore_index=True) self.tasks = pd.concat([self.tasks, row], ignore_index = True)[self.tasks.columns] @@ -342,6 +342,7 @@ class Job(): # Telechargement # todo + # keep list of downloaded l1c products # Nettoyage if clean_before: @@ -371,6 +372,10 @@ class Job(): if self.logs: f.write("\nTraitement des l1c : {}\n".format(l2a_res)) f.write("l1c_process_list: \n" + "\n".join(l1c_process_list) + "\n") + + # Remove L1C + # todo + # remove list of downloaded l1c products # Traitement des L2A (clouds) logger.info("Computing cloudmasks") @@ -439,6 +444,9 @@ class Job(): if self.logs: f.write("\nTraitement des indices: {}\n".format(indices_res)) f.write("indices_l2a_process_list: \n" + "\n".join(indices_l2a_process_list) + "\n") + + # Remove L2A + # todo else: logger.info("No task defined for this job, doing nothing") diff --git a/sen2chain/products.py b/sen2chain/products.py index 594b30ad05a60d8c262ad462c14703e790efebe5..f93bff57706fd160c1a850635f9b04b731cb227b 100755 --- a/sen2chain/products.py +++ b/sen2chain/products.py @@ -8,6 +8,7 @@ import pathlib import shutil import logging import re +import os from pathlib import Path # type annotations @@ -253,15 +254,15 @@ class L1cProduct(Product): def remove(self): if self.path.is_symlink(): - l1c_path = os.readlink(str(self.path)) - logger.info("Removing: {}".format(l1c_path)) - shutil.rmtree(l1c_path) - logger.info("Removing symlink: {}".format(self.path)) - self.path.unlink() - else: - #~ l1c_path = os.readlink(str(l1c.path)) - logger.info("Removing: {}".format(self.path)) - shutil.rmtree(str(self.path)) + l1c_path = os.readlink(str(self.path)) + logger.info("Removing: {}".format(l1c_path)) + shutil.rmtree(l1c_path) + logger.info("Removing symlink: {}".format(self.path)) + self.path.unlink() + else: + #~ l1c_path = os.readlink(str(l1c.path)) + logger.info("Removing: {}".format(self.path)) + shutil.rmtree(str(self.path)) # METADATA @property @@ -810,14 +811,13 @@ class L2aProduct(Product): def remove(self): if self.path.is_symlink(): - l2a_path = os.readlink(str(self.path)) - logger.info("Removing: {}".format(l2a_path)) - shutil.rmtree(l2a_path) - logger.info("Removing symlink: {}".format(self.path)) - self.path.unlink() - else: - logger.info("Removing: {}".format(self.path)) - shutil.rmtree(str(self.path)) + l2a_path = os.readlink(str(self.path)) + logger.info("Removing: {}".format(l2a_path)) + shutil.rmtree(l2a_path) + logger.info("Removing symlink: {}".format(self.path)) + self.path.unlink() + else: + shutil.rmtree(str(self.path)) logger.info("Removing: {}".format(self.path)) @property