From 3be06628321011881b3e5d8f0d6eb4d1aab88003 Mon Sep 17 00:00:00 2001
From: Impact <pascal.mouquet@ird.fr>
Date: Thu, 7 Nov 2019 14:21:31 +0400
Subject: [PATCH] correction to prevent nodata value change issue when
 producing jp2 indice mask images from jp2 indice images

---
 sen2chain/indices_functions.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sen2chain/indices_functions.py b/sen2chain/indices_functions.py
index cd96f47..caa8749 100644
--- a/sen2chain/indices_functions.py
+++ b/sen2chain/indices_functions.py
@@ -337,7 +337,8 @@ def create_masked_indice(
                   resampling=Resampling.nearest)
 #        indice_borders_mask = np.where(raw_indice > 0, raw_indice, 32767)
         indice_cloud_mask = np.where(cld_reproj == 0, raw_indice, 32767)
-
+        if indice_path.suffix == ".jp2":
+            indice_cloud_mask = np.where(indice_cloud_mask == 16383, 32767, indice_cloud_mask)
         profile.update(driver="Gtiff",
                         compress="DEFLATE",
                         tiled=False,
-- 
GitLab