From a178e50d7bfb62ee318a3ee8bca3034cbf215f5d Mon Sep 17 00:00:00 2001
From: Narcon Nicolas <nicolas.narcon@inrae.fr>
Date: Fri, 25 Feb 2022 11:35:43 +0100
Subject: [PATCH 1/2] FIX: fix a check so that uint8 pixel type is considered
 when using propagate_pixel_type

---
 pyotb/core.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/pyotb/core.py b/pyotb/core.py
index cb74243..6ca415c 100644
--- a/pyotb/core.py
+++ b/pyotb/core.py
@@ -617,7 +617,7 @@ class App(otbObject):
                 pixel_type = get_pixel_type(param)
             except TypeError:
                 pass
-        if not pixel_type:
+        if pixel_type is not None:  # we use this syntax because pixel_type can be equal to 0
             logger.warning(f"{self.name}: Could not propagate pixel type from inputs to output, " +
                            f"no valid input found")
         else:
@@ -926,8 +926,8 @@ def get_pixel_type(inp):
     """
     Get the encoding of input image pixels
     :param inp: a filepath, or any pyotb object
-    :return pixel_type: format is like `otbApplication.ImagePixelType_uint8'. For an App with several outputs, only the
-                        pixel type of the first output is returned
+    :return pixel_type: format is like `otbApplication.ImagePixelType_uint8', which actually is an int. For an App
+                        with several outputs, only the pixel type of the first output is returned
 
     """
     if isinstance(inp, str):
-- 
GitLab


From 1438b006b9d82e655229124771ca7f2a4c8f9536 Mon Sep 17 00:00:00 2001
From: Narcon Nicolas <nicolas.narcon@inrae.fr>
Date: Fri, 25 Feb 2022 11:36:46 +0100
Subject: [PATCH 2/2] FIX: mistake in negation

---
 pyotb/core.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pyotb/core.py b/pyotb/core.py
index 6ca415c..a461fc1 100644
--- a/pyotb/core.py
+++ b/pyotb/core.py
@@ -617,7 +617,7 @@ class App(otbObject):
                 pixel_type = get_pixel_type(param)
             except TypeError:
                 pass
-        if pixel_type is not None:  # we use this syntax because pixel_type can be equal to 0
+        if pixel_type is None:  # we use this syntax because pixel_type can be equal to 0
             logger.warning(f"{self.name}: Could not propagate pixel type from inputs to output, " +
                            f"no valid input found")
         else:
-- 
GitLab