0

I have to decompress a .Z file which contains NDVI data in compressed state I am using zlib to decompress it

str_object1 = open('Downloads/2019090120190930.Z', 'rb').read()
str_object2 = zlib.decompress(str_object1, -zlib.MAX_WBITS)

It is showing error

Error -3 while decompressing data: invalid block type

if I remove -zlib.MAX_WBITS It is showing error

Error -3 while decompressing data: incorrect header check

Please help Here is the link to the file http://www.bom.gov.au/web03/ncc/www/awap/ndvi/ndviave/month/grid/history/nat/2019090120190930.Z

Yudh
  • 1
  • Does this answer your question? [Uncompressing a .Z file with Python](https://stackoverflow.com/questions/32921263/uncompressing-a-z-file-with-python) – Ture Pålsson Oct 14 '20 at 07:29

1 Answers1

0

It's not a zlib file. That file was made by the ancient Unix compress command. You'll need to shell out to gzip to decompress it. See this answer.

Mark Adler
  • 101,978
  • 13
  • 118
  • 158