Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
res = np.amax(arr, axis=tuple(range(0, len(arr.shape) - 1)))
assert len(res.shape) == 1
assert len(_shape[s:]) == res.shape[0]
_shape[s:] = res
_shape = tuple(_shape)
slices = Bbox(Vec.zeros(_shape), _shape).reify_slices(slices, bounded=True)
requested_bbox = Bbox.from_slices(slices)
# Make sure chunks fit
full_bbox = requested_bbox.expand_to_chunk_size(
self.chunk, offset=Vec.zeros(self.shape)
)
# Clamb the border
full_bbox = Bbox.clamp(full_bbox, Bbox(Vec.zeros(self.shape), self.shape))
# Generate chunknames
cloudpaths = list(
chunknames(
full_bbox,
self.shape,
self._path,
self.chunk,
protocol="none", # self.protocol
)
)
return cloudpaths, requested_bbox
slices = (slices,)
elif isinstance(slices, slice):
slices = (slices,)
slices = tuple(slices)
_shape = list(self.shape)
if self._darray is not None:
s = len(self._darray.shape) - 1
arr = self._darray[slices[:s]]
res = np.amax(arr, axis=tuple(range(0, len(arr.shape) - 1)))
assert len(res.shape) == 1
assert len(_shape[s:]) == res.shape[0]
_shape[s:] = res
_shape = tuple(_shape)
slices = Bbox(Vec.zeros(_shape), _shape).reify_slices(slices, bounded=True)
requested_bbox = Bbox.from_slices(slices)
# Make sure chunks fit
full_bbox = requested_bbox.expand_to_chunk_size(
self.chunk, offset=Vec.zeros(self.shape)
)
# Clamb the border
full_bbox = Bbox.clamp(full_bbox, Bbox(Vec.zeros(self.shape), self.shape))
# Generate chunknames
cloudpaths = list(
chunknames(
full_bbox,
self.shape,
self._path,
_shape = list(self.shape)
if self._darray is not None:
s = len(self._darray.shape) - 1
arr = self._darray[slices[:s]]
res = np.amax(arr, axis=tuple(range(0, len(arr.shape) - 1)))
assert len(res.shape) == 1
assert len(_shape[s:]) == res.shape[0]
_shape[s:] = res
_shape = tuple(_shape)
slices = Bbox(Vec.zeros(_shape), _shape).reify_slices(slices, bounded=True)
requested_bbox = Bbox.from_slices(slices)
# Make sure chunks fit
full_bbox = requested_bbox.expand_to_chunk_size(
self.chunk, offset=Vec.zeros(self.shape)
)
# Clamb the border
full_bbox = Bbox.clamp(full_bbox, Bbox(Vec.zeros(self.shape), self.shape))
# Generate chunknames
cloudpaths = list(
chunknames(
full_bbox,
self.shape,
self._path,
self.chunk,
protocol="none", # self.protocol
)
)