Skip to content
Snippets Groups Projects
Commit 13a327d3 authored by pascal.mouquet_ird.fr's avatar pascal.mouquet_ird.fr
Browse files

a few changes to job

parent ad7ce4ac
No related branches found
No related tags found
No related merge requests found
Pipeline #1237 passed
......@@ -6,7 +6,7 @@
# 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
# remove: to remove downloaded L1C and/or produced L2A, possible values: False | l1c | l2a | l1c/l2a
# comments: free user comments, ie tile name, etc.
logs = False
......
......@@ -217,7 +217,7 @@ class Job:
"# 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",
"# remove: to remove downloaded L1C and/or produced L2A, possible values: False | l1c | l2a | l1c/l2a",
"# comments: free user comments, ie tile name, etc.",
"",
"",
......@@ -509,9 +509,9 @@ class Job:
for index, row in tasks.iterrows():
if bool(setuptools.distutils.util.strtobool(str(row.l1c))):
t = Tile(row.tile)
logger.info("Tile: {}".format(t.name))
logger.info("Adding tile: {}".format(t.name))
if self.logs:
f.write("Tile: {}\n".format(t.name))
f.write("Adding tile: {}\n".format(t.name))
f.flush()
tile_download_list = t.get_l1c(
......@@ -530,9 +530,11 @@ class Job:
# S2cEodag_download(download_list, "multip")
after_list = [p.location for p in download_list]
downloaded_products = [Path(after_list[i]).stem for i in range(len(before_list)) if before_list[i] != after_list[i]]
logger.info("Downloaded product(s): {}".format(downloaded_products))
logger.info("{} product(s) downloaded: {}\n\n".format(len(downloaded_products), downloaded_products))
if self.logs:
f.write("{} downloaded product(s): {}\n\n".format(len(downloaded_products), downloaded_products))
f.write("{} product(s) downloaded: \n".format(len(downloaded_products)))
for pro in downloaded_products:
f.write("{}\n\n".format(pro))
f.flush()
# Traitement des L1C en L2A
......@@ -581,8 +583,8 @@ class Job:
for index, row in tasks.iterrows():
if "l1c" in str(row.remove).lower():
t = Tile(row.tile)
prodlist = [p for p in downloaded_products if row.tile in p]
t.remove_l1c(prodlist)
prodlist = [p for p in l1c_process_list if row.tile in p]
t.remove_l2a(prodlist)
logger.info("Removing downloaded l1c products: {}".format(prodlist))
if self.logs:
f.write("Removing downloaded l1c products: {}\n\n".format(prodlist))
......@@ -609,7 +611,7 @@ class Job:
for j in l2a_to_process:
l2a_cm_details = [
j,
cloudmask["cm_version"],
cloudmask["cm_version"].lower(),
cloudmask["probability"],
cloudmask["iterations"],
cloudmask["cld_shad"],
......@@ -639,10 +641,11 @@ class Job:
)
if self.logs:
f.write(
"Cloudmask computing process list ({} l2a products): {}\n\n".format(
len(cld_l2a_process_list), cld_l2a_process_list
)
"Cloudmask computing process list ({} l2a products):\n".format(
len(cld_l2a_process_list), )
)
for cld in cld_l2a_process_list:
f.write("{}\n\n".format(cld))
f.flush()
cld_res = False
......@@ -709,10 +712,12 @@ class Job:
)
if self.logs:
f.write(
"Indice computing process list ({} l2a products): {}\n\n".format(
len(indices_l2a_process_list), indices_l2a_process_list
"Indice computing process list ({} l2a products): {}\n".format(
len(indices_l2a_process_list),
)
)
for ind in indices_l2a_process_list:
f.write("{}\n\n".format(ind))
f.flush()
indices_res = False
......@@ -722,7 +727,22 @@ class Job:
)
# Remove L2A
# todo
l2a_remove_list = list(
set(
cld_l2a_process_list + [ind[0] for ind in indices_l2a_process_list]
)
)
for index, row in tasks.iterrows():
if "l2a" in str(row.remove).lower():
t = Tile(row.tile)
prodlist = [p for p in l2a_remove_list if row.tile in p]
t.remove_l2a(prodlist)
logger.info("Removing {} produced l2a product(s): {}".format(len(prodlist), prodlist))
if self.logs:
f.write("Removing {} produced l2a products: {}\n".format(len(prodlist)))
for l2a in prodlist:
f.write("{}\n\n".format(l2a))
f.flush()
# Cleaning after
if clean_after:
......
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