From 93eaa695cdad507ebbce0b5f34c7a7034f17d5da Mon Sep 17 00:00:00 2001 From: k034b363 Date: Tue, 17 Sep 2024 11:20:11 -0500 Subject: [PATCH] Fix deepsource issues and failing tests in save_geotif --- plantcv/geospatial/save_geotif.py | 3 +-- tests/test_geospatial_save_geotif.py | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/plantcv/geospatial/save_geotif.py b/plantcv/geospatial/save_geotif.py index 9b3696e..959d1eb 100644 --- a/plantcv/geospatial/save_geotif.py +++ b/plantcv/geospatial/save_geotif.py @@ -1,7 +1,6 @@ # Save georeferenced TIF files from plantcv segmented masks import rasterio -from rasterio.mask import mask def save_geotif(out_img, in_img, out_path, nodata=None): @@ -34,7 +33,7 @@ def save_geotif(out_img, in_img, out_path, nodata=None): # For color outputs if len(out_img.shape) == 3: # Reorder dimensions - out_img = out_img.transpose(2,0,1) + out_img = out_img.transpose(2, 0, 1) # Reorder channels if needed chord = [waves[480], waves[560], waves[650]] # For multispec diff --git a/tests/test_geospatial_save_geotif.py b/tests/test_geospatial_save_geotif.py index 54f5d06..372304a 100644 --- a/tests/test_geospatial_save_geotif.py +++ b/tests/test_geospatial_save_geotif.py @@ -12,7 +12,7 @@ def test_save_geotif_color(test_data, tmpdir): # Create test image img = read_geotif(filename=test_data.cropped_tif, bands="B,G,R,RE,N") filename = os.path.join(cache_dir, 'test.tif') - save_geotif(out_img=img, in_img=img, out_path=filename) + save_geotif(out_img=img.array_data, in_img=img, out_path=filename) # Assert that the file was created assert os.path.exists(filename)