Skip to content
Snippets Groups Projects
Commit 00e2dabf authored by Vincent Delbar's avatar Vincent Delbar
Browse files

BUG: fixes #123

parent e819878d
No related branches found
No related tags found
1 merge request!109Fix for ignored uint8 pixel_type in write()
Pipeline #14382 passed
......@@ -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(
......
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()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment