Commit 7415851f authored by Daniel Scheffler's avatar Daniel Scheffler

Merge branch 'bugfix/fix_bandname_types' into 'master'

Fixed mixed types of band names. Updated version info.

See merge request !12
parents 30c98cd5 b066a371
Pipeline #5004 passed with stages
in 1 minute and 32 seconds
......@@ -177,7 +177,9 @@ class GDAL_Metadata(object):
item_str.split('}')[0].strip() if item_str.strip().endswith('}') else
item_str.strip() for item_str in v.split(',')]
self.band_meta[k] = [self._convert_param_from_str(item_str) for item_str in item_list]
self.band_meta[k] = \
[self._convert_param_from_str(item_str) for item_str in item_list] \
if k != 'band_names' else item_list
else:
# global meta parameter
......
......@@ -20,5 +20,5 @@
# with this program. If not, see <http://www.gnu.org/licenses/>.
__version__ = '0.8.24'
__versionalias__ = '20191010.01'
__version__ = '0.8.25'
__versionalias__ = '20191010.02'
......@@ -65,14 +65,15 @@ class Test_GDAL_Metadata(TestCase):
def test_read_bandnames(self):
outPath = os.path.join(self.tmpOutdir.name, 'read_bandnames_correctly.bsq')
bandnames = ['test1', 'band_2', 'layer 3']
bandnames = ['test1', 'band_2', 'layer 3', '12']
gA = GeoArray(np.random.randint(1, 10, (5, 5, 3)))
gA = GeoArray(np.random.randint(1, 10, (5, 5, 4)))
gA.bandnames = bandnames
gA.save(outPath)
gA = GeoArray(outPath)
self.assertEqual(list(gA.bandnames.keys()), bandnames)
self.assertTrue(all([isinstance(bN, str) for bN in gA.bandnames.keys()]))
def test_save_bandnames(self):
outPath = os.path.join(self.tmpOutdir.name, 'save_bandnames_from_numpy.bsq')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment