Commit 297fa33f authored by Daniel Scheffler's avatar Daniel Scheffler

Bugfixes.

parent feb1eb3d
Pipeline #3069 failed with stages
in 1 minute and 10 seconds
...@@ -4,6 +4,7 @@ import os ...@@ -4,6 +4,7 @@ import os
import warnings import warnings
from importlib import util from importlib import util
from collections import OrderedDict from collections import OrderedDict
from copy import deepcopy
import numpy as np import numpy as np
from matplotlib import pyplot as plt from matplotlib import pyplot as plt
...@@ -1476,7 +1477,11 @@ class GeoArray(object): ...@@ -1476,7 +1477,11 @@ class GeoArray(object):
# apply zslice to bandnames and metadata # apply zslice to bandnames and metadata
if zslicing: if zslicing:
bNs_out = list(np.array(list(self.bandnames))[zslice]) bNs_out = list(np.array(list(self.bandnames))[zslice])
_meta_out = None if self._metadata is None else self.meta[list(np.array(range(self.bands))[zslice])]
_meta_out = deepcopy(self.meta)
if self._metadata:
for k, v in _meta_out.band_meta.items():
_meta_out.band_meta[k] = list(np.array(v)[zslice])
else: else:
bNs_out = list(self.bandnames) bNs_out = list(self.bandnames)
_meta_out = self.meta _meta_out = self.meta
......
...@@ -24,7 +24,6 @@ Program started in Mai 2017. ...@@ -24,7 +24,6 @@ Program started in Mai 2017.
from __future__ import print_function from __future__ import print_function
from collections import OrderedDict from collections import OrderedDict
import dill import dill
import geopandas
import numpy as np import numpy as np
import os import os
from os import path from os import path
...@@ -43,6 +42,7 @@ from py_tools_ds.geo.vector import geometry ...@@ -43,6 +42,7 @@ from py_tools_ds.geo.vector import geometry
from py_tools_ds.compatibility.python.os import makedirs from py_tools_ds.compatibility.python.os import makedirs
matplotlib.use('Template') # disables matplotlib figure popups matplotlib.use('Template') # disables matplotlib figure popups
from geoarray import GeoArray, masks, __file__ # noqa E402 module level import not at top of file from geoarray import GeoArray, masks, __file__ # noqa E402 module level import not at top of file
from geoarray.metadata import GDAL_Metadata # noqa E402 module level import not at top of file
__author__ = 'Jessica Palka' __author__ = 'Jessica Palka'
...@@ -453,7 +453,7 @@ class Test_GeoarrayFunctions(unittest.TestCase): ...@@ -453,7 +453,7 @@ class Test_GeoarrayFunctions(unittest.TestCase):
Test, if the output of the metadata-function is an instance of GeoDataFrame. Test, if the output of the metadata-function is an instance of GeoDataFrame.
""" """
self.assertIsInstance(self.testtiff.metadata, geopandas.GeoDataFrame) self.assertIsInstance(self.testtiff.metadata, GDAL_Metadata)
def test_tiles(self): def test_tiles(self):
test_gAs = [self.testtiff, # 3D test_gAs = [self.testtiff, # 3D
......
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