Skip to content

Commit

Permalink
Fix deepsource issues and failing tests in save_geotif
Browse files Browse the repository at this point in the history
  • Loading branch information
k034b363 committed Sep 17, 2024
1 parent 2dafa76 commit 93eaa69
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions plantcv/geospatial/save_geotif.py
Original file line number Diff line number Diff line change
@@ -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):
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/test_geospatial_save_geotif.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 93eaa69

Please sign in to comment.