Bladeren bron

[Fix] raster read bugfix

Yizhou Chen 2 jaren geleden
bovenliggende
commit
0d5c5f365b
1 gewijzigde bestanden met toevoegingen van 3 en 2 verwijderingen
  1. 3 2
      tools/utils/raster.py

+ 3 - 2
tools/utils/raster.py

@@ -94,7 +94,7 @@ class Raster:
         """
         if self._src_data is not None:
             if start_loc is None:
-                return self._getAarray()
+                return self._getArray()
             else:
                 return self._getBlock(start_loc, block_size)
         else:
@@ -157,10 +157,11 @@ class Raster:
                 band_array.append(band_i)
             ima = np.stack(band_array, axis=0)
         if self.bands == 1:
+            if len(ima.shape) == 3:
+                ima = ima.squeeze(0)
             # the type is complex means this is a SAR data
             if isinstance(type(ima[0, 0]), complex):
                 ima = abs(ima)
-            ima = ima.squeeze()
         else:
             ima = ima.transpose((1, 2, 0))
         if self.to_uint8 is True: