Commit f5241fee authored by Daniel Scheffler's avatar Daniel Scheffler
Browse files

Refactored function name and updated docstring.

parent 56146895
Pipeline #3200 passed with stages
in 1 minute and 41 seconds
......@@ -826,8 +826,8 @@ class GeoArray(object):
# NOTE: # bandlist must be string because truth value of an array with more than one element is ambiguous
arr_pos = dict(rS=rS, rE=rE, cS=cS, cE=cE, bS=bS, bE=bE, bL=bL)
def _ensure_np_shape_3D_2D(arr):
"""Match numpy output shape according to the given indexing parameters.
def _ensure_np_shape_consistency_3D_2D(arr):
"""Ensure numpy output shape consistency according to the given indexing parameters.
This may require 3D to 2D conversion in case out_arr can be represented by a 2D array AND index has been
provided as integer (avoids shapes like (1,2,2). It also may require 2D to 3D conversion in case only one
......@@ -857,7 +857,7 @@ class GeoArray(object):
# check if the requested array position is already in cache -> if yes, return it from there
if self._arr_cache is not None and self._arr_cache['pos'] == arr_pos:
out_arr = self._arr_cache['arr_cached']
out_arr = _ensure_np_shape_3D_2D(out_arr)
out_arr = _ensure_np_shape_consistency_3D_2D(out_arr)
# TODO insert a multiprocessing.Lock here in order to prevent IO bottlenecks?
......@@ -886,7 +886,7 @@ class GeoArray(object):
del ds
out_arr = _ensure_np_shape_3D_2D(out_arr)
out_arr = _ensure_np_shape_consistency_3D_2D(out_arr)
# only set self.arr if the whole cube has been read (in order to avoid sudden shape changes)
if out_arr.shape == self.shape:
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