Hello, I’m getting a similar error (shown below) when running the download client request:
data = SentinelHubDownloadClient(config=config).download(list_of_requests, max_threads=5)
Error:
DeflateError Traceback (most recent call last)
Cell In[94], line 3
1 # download data with multiple threads - ndwi
2 #data = SentinelHubDownloadClient(config=config).download(list_of_requests, max_threads=5)
----> 3 data = SentinelHubDownloadClient(config=config).download(list_of_requests)
File ~\AppData\Local\miniconda3\envs\sentinelhub\lib\site-packages\sentinelhub\download\sentinelhub_client.py:62, in SentinelHubDownloadClient.download(self, *args, **kwargs)
60 self.lock = Lock()
61 try:
---> 62 return super().download(*args, **kwargs)
63 finally:
64 self.lock = None
File ~\AppData\Local\miniconda3\envs\sentinelhub\lib\site-packages\sentinelhub\download\client.py:101, in DownloadClient.download(self, download_requests, max_threads, decode_data, show_progress)
99 for future in as_completed(download_list):
100 try:
--> 101 results[future_order[future]] = future.result()
102 except DownloadFailedException as download_exception:
103 if self.raise_download_errors:
File ~\AppData\Local\miniconda3\envs\sentinelhub\lib\concurrent\futures\_base.py:439, in Future.result(self, timeout)
437 raise CancelledError()
438 elif self._state == FINISHED:
--> 439 return self.__get_result()
441 self._condition.wait(timeout)
443 if self._state in [CANCELLED, CANCELLED_AND_NOTIFIED]:
File ~\AppData\Local\miniconda3\envs\sentinelhub\lib\concurrent\futures\_base.py:391, in Future.__get_result(self)
389 if self._exception:
390 try:
--> 391 raise self._exception
392 finally:
393 # Break a reference cycle with the exception in self._exception
394 self = None
File ~\AppData\Local\miniconda3\envs\sentinelhub\lib\concurrent\futures\thread.py:58, in _WorkItem.run(self)
55 return
57 try:
---> 58 result = self.fn(*self.args, **self.kwargs)
59 except BaseException as exc:
60 self.future.set_exception(exc)
File ~\AppData\Local\miniconda3\envs\sentinelhub\lib\site-packages\sentinelhub\download\client.py:118, in DownloadClient._single_download_decoded(self, request)
116 """Downloads a response and decodes it into data. By decoding a single response"""
117 response = self._single_download(request)
--> 118 return None if response is None else response.decode()
File ~\AppData\Local\miniconda3\envs\sentinelhub\lib\site-packages\sentinelhub\download\models.py:246, in DownloadResponse.decode(self)
244 def decode(self) -> Any:
245 """Decodes binary data into a Python object."""
--> 246 return decode_data(self.content, data_type=self.response_type)
File ~\AppData\Local\miniconda3\envs\sentinelhub\lib\site-packages\sentinelhub\decoding.py:38, in decode_data(response_content, data_type)
36 return decode_tar(response_content)
37 if MimeType.is_image_format(data_type):
---> 38 return decode_image(response_content, data_type)
39 if data_type is MimeType.XML or data_type is MimeType.GML or data_type is MimeType.SAFE:
40 return ElementTree.fromstring(response_content)
File ~\AppData\Local\miniconda3\envs\sentinelhub\lib\site-packages\sentinelhub\decoding.py:63, in decode_image(data, image_type)
61 bytes_data = BytesIO(data)
62 if image_type is MimeType.TIFF:
---> 63 image = tiff.imread(bytes_data)
64 elif image_type is MimeType.JP2:
65 image = decode_jp2_image(bytes_data)
File ~\AppData\Local\miniconda3\envs\sentinelhub\lib\site-packages\tifffile\tifffile.py:784, in imread(files, aszarr, **kwargs)
782 if aszarr:
783 return tif.aszarr(**kwargs)
--> 784 return tif.asarray(**kwargs)
786 with TiffSequence(files, **kwargs_seq) as imseq:
787 if aszarr:
File ~\AppData\Local\miniconda3\envs\sentinelhub\lib\site-packages\tifffile\tifffile.py:3119, in TiffFile.asarray(self, key, series, level, squeeze, out, maxworkers)
3115 result = self.filehandle.read_array(
3116 typecode, product(shape), out=out
3117 )
3118 elif len(pages) == 1:
-> 3119 result = pages[0].asarray(out=out, maxworkers=maxworkers)
3120 else:
3121 result = stack_pages(pages, out=out, maxworkers=maxworkers)
File ~\AppData\Local\miniconda3\envs\sentinelhub\lib\site-packages\tifffile\tifffile.py:6317, in TiffPage.asarray(self, out, squeeze, lock, maxworkers)
6311 result[
6312 s, d : d + shape[0], l : l + shape[1], w : w + shape[2]
6313 ] = segment
6314 # except IndexError:
6315 # pass # corrupted files e.g. with too many strips
-> 6317 for _ in self.segments(
6318 func=func,
6319 lock=lock,
6320 maxworkers=maxworkers,
6321 sort=True,
6322 _fullsize=False,
6323 ):
6324 pass
6326 result.shape = keyframe.shaped
File ~\AppData\Local\miniconda3\envs\sentinelhub\lib\site-packages\tifffile\tifffile.py:6183, in TiffPage.segments(self, lock, maxworkers, func, sort, _fullsize)
6175 with ThreadPoolExecutor(maxworkers) as executor:
6176 for segments in fh.read_segments(
6177 self.dataoffsets,
6178 self.databytecounts,
(...)
6181 flat=False,
6182 ):
-> 6183 yield from executor.map(decode, segments)
File ~\AppData\Local\miniconda3\envs\sentinelhub\lib\concurrent\futures\_base.py:609, in Executor.map.<locals>.result_iterator()
606 while fs:
607 # Careful not to keep a reference to the popped future
608 if timeout is None:
--> 609 yield fs.pop().result()
610 else:
611 yield fs.pop().result(end_time - time.monotonic())
File ~\AppData\Local\miniconda3\envs\sentinelhub\lib\concurrent\futures\_base.py:439, in Future.result(self, timeout)
437 raise CancelledError()
438 elif self._state == FINISHED:
--> 439 return self.__get_result()
441 self._condition.wait(timeout)
443 if self._state in [CANCELLED, CANCELLED_AND_NOTIFIED]:
File ~\AppData\Local\miniconda3\envs\sentinelhub\lib\concurrent\futures\_base.py:391, in Future.__get_result(self)
389 if self._exception:
390 try:
--> 391 raise self._exception
392 finally:
393 # Break a reference cycle with the exception in self._exception
394 self = None
File ~\AppData\Local\miniconda3\envs\sentinelhub\lib\concurrent\futures\thread.py:58, in _WorkItem.run(self)
55 return
57 try:
---> 58 result = self.fn(*self.args, **self.kwargs)
59 except BaseException as exc:
60 self.future.set_exception(exc)
File ~\AppData\Local\miniconda3\envs\sentinelhub\lib\site-packages\tifffile\tifffile.py:6155, in TiffPage.segments.<locals>.decode(args, decodeargs, keyframe, func)
6154 def decode(args, decodeargs=decodeargs, keyframe=keyframe, func=func):
-> 6155 result = keyframe.decode(*args, **decodeargs)
6156 if func is not None:
6157 return func(result)
File ~\AppData\Local\miniconda3\envs\sentinelhub\lib\site-packages\tifffile\tifffile.py:6122, in TiffPage.decode.<locals>.decode(data, segmentindex, jpegtables, _fullsize)
6119 if decompress is not None:
6120 # TODO: calculate correct size for packed integers
6121 size = shape[0] * shape[1] * shape[2] * shape[3]
-> 6122 data = decompress(data, out=size * dtype.itemsize)
6123 data = unpack(data)
6124 data = reshape(data, index, shape)
File imagecodecs\_deflate.pyx:222, in imagecodecs._deflate.deflate_decode()
DeflateError: libdeflate_zlib_decompress returned LIBDEFLATE_BAD_DATA
# download data with multiple threads - rgb
data_rgb = SentinelHubDownloadClient(config=config).download(list_of_requests_rgb, max_threads=5)