[ValueError: GeoArray.metadata can only be set]: in case the GeoArray instance has only 1 row/column/band or only 1 row/colum/band is requested
This only happens in case an array dimension has only one element or a single row/column/band is requested:
im = GeoArray('/home/gfz-fe/scheffler/temp/Landsat-8__OLI_TIRS__LC81940242014072LGN00_L2B.bsq')
sub = im.get_subset(xslice=slice(0, 1))
OUT:
ValueError Traceback (most recent call last)
<ipython-input-133-c683229ddcbd> in <module>()
1 im = GeoArray('/home/gfz-fe/scheffler/temp/Landsat-8__OLI_TIRS__LC81940242014072LGN00_L2B.bsq')
----> 2 sub = im.get_subset(xslice=slice(0, 1))
3 sub.shape
~/scheffler/python/geoarray/geoarray/baseclasses.py in get_subset(self, xslice, yslice, zslice, return_GeoArray, reset_bandnames)
1541
1542 sub_gA.gt = sub_gt
-> 1543 sub_gA.metadata = _meta_out
1544 sub_gA.bandnames = bNs_out
1545 sub_gA.filePath = self.filePath
~/scheffler/python/geoarray/geoarray/baseclasses.py in metadata(self, meta)
517 raise ValueError("%s.metadata can only be set with an instance of geoarray.metadata.GDAL_Metadata of "
518 "which the band number corresponds to the band number of %s."
--> 519 % (self.__class__.__name__, self.__class__.__name__))
520 self._metadata = meta
521
ValueError: GeoArray.metadata can only be set with an instance of geoarray.metadata.GDAL_Metadata of which the band number corresponds to the band number of GeoArray.