From 3804104c24a111a8132b81124b08c77de5603a61 Mon Sep 17 00:00:00 2001
From: Christophe R <christophe.seasoi@gmail.com>
Date: Tue, 30 Apr 2019 14:19:48 +0400
Subject: [PATCH] new script example

---
 script_examples/process_l2a_and_products.py | 39 +++++++++++++++++++++
 1 file changed, 39 insertions(+)
 create mode 100644 script_examples/process_l2a_and_products.py

diff --git a/script_examples/process_l2a_and_products.py b/script_examples/process_l2a_and_products.py
new file mode 100644
index 0000000..6f1a755
--- /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)
-- 
GitLab