diff --git a/pyotb/core.py b/pyotb/core.py index 9cd9d4eeff26ce85ccd1eb63ffef30b3445e3935..0b0124910224864e8d06d2b100cf3722fc55470f 100644 --- a/pyotb/core.py +++ b/pyotb/core.py @@ -764,7 +764,7 @@ class App(OTBObject): dtype: data type to use """ - if not dtype: + if dtype is None: param = self._settings.get(self.input_image_key) if not param: logger.warning( diff --git a/tests/test_core.py b/tests/test_core.py index 8b3f8fae5fbe66124ceb3c6911e09aca11ba010b..a84d5eb2965eb7291d31c8ff52e7105cbf812cc0 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -1,6 +1,7 @@ import pytest import numpy as np +import pyotb from tests_data import * @@ -144,11 +145,17 @@ def test_xy_to_rowcol(): def test_write(): - assert INPUT.write("/dev/shm/test_write.tif", ext_fname="nodata=0") + # Write string filepath + assert INPUT.write("/dev/shm/test_write.tif") + INPUT["out"].filepath.unlink() + # With Path filepath + assert INPUT.write(Path("/dev/shm/test_write.tif")) INPUT["out"].filepath.unlink() - assert INPUT.write(Path("/dev/shm/test_write.tif"), ext_fname="nodata=0") + # Write to uint8 + assert INPUT.write(Path("/dev/shm/test_write.tif"), pixel_type="uint8") + assert INPUT["out"].dtype == "uint8" INPUT["out"].filepath.unlink() - # Frozen + # Write frozen app frozen_app = pyotb.BandMath(INPUT, exp="im1b1", frozen=True) assert frozen_app.write("/dev/shm/test_frozen_app_write.tif") frozen_app["out"].filepath.unlink()