Procházet zdrojové kódy

[Fix] raster read bugfix

Yizhou Chen před 2 roky
rodič
revize
0d5c5f365b
1 změnil soubory, kde provedl 3 přidání a 2 odebrání
  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 self._src_data is not None:
             if start_loc is None:
             if start_loc is None:
-                return self._getAarray()
+                return self._getArray()
             else:
             else:
                 return self._getBlock(start_loc, block_size)
                 return self._getBlock(start_loc, block_size)
         else:
         else:
@@ -157,10 +157,11 @@ class Raster:
                 band_array.append(band_i)
                 band_array.append(band_i)
             ima = np.stack(band_array, axis=0)
             ima = np.stack(band_array, axis=0)
         if self.bands == 1:
         if self.bands == 1:
+            if len(ima.shape) == 3:
+                ima = ima.squeeze(0)
             # the type is complex means this is a SAR data
             # the type is complex means this is a SAR data
             if isinstance(type(ima[0, 0]), complex):
             if isinstance(type(ima[0, 0]), complex):
                 ima = abs(ima)
                 ima = abs(ima)
-            ima = ima.squeeze()
         else:
         else:
             ima = ima.transpose((1, 2, 0))
             ima = ima.transpose((1, 2, 0))
         if self.to_uint8 is True:
         if self.to_uint8 is True: