diff --git a/script_examples/process_l2a_and_products.py b/script_examples/process_l2a_and_products.py new file mode 100644 index 0000000000000000000000000000000000000000..6f1a755279e2f018e13e583b3680e697a9e3850d --- /dev/null +++ b/script_examples/process_l2a_and_products.py @@ -0,0 +1,39 @@ +# -*- coding:utf-8 -*- + +#~ Starts processing on L1C that have been downloaded +#~ but have not been processed +#~ More examples and details on the sen2chain wiki : https://framagit.org/jebins/sen2chain/wikis/Home + +from sen2chain import Tile, L1cProduct, L2aProduct + + +def process_missings(tile): + """ + Processing function + """ + t = Tile(tile) + for p in t.l2a_missings: + l1c = L1cProduct(p.identifier, t.name) + try: + l1c.process_l2a() + except: + print("FAILED:", p.identifier) + continue + + for p in t.l2a: + l2a = L2aProduct(p.identifier, t.name) + try: + l2a.process_cloud_mask_v2() +#~ list of indices to be caculated (available : NDVI/NDWIGAO/NDWIMCF/BIGR/BIRNIR/BIBG), +#~ And calculation of clouds_nodata (True/False) and quicklook (True/False) + l2a.process_indices(["NDVI","NDWIGAO","NDWIMCF","MNDWI"], True, True) + except: + print("FAILED:", p.identifier) + continue + +# list of tiles to be processed (Reunion Island example) +tiles = ["40KCB"] + +for t in tiles: + print("Processing:", t) + process_missings(t)