Skip to main content

How to open jp2 files from DownloadResponse objects

  • April 17, 2024
  • 1 reply
  • 0 views

Hi, I’m downloading scene bands from Sentinel Hub using the get_data method of the AwsTileRequest class.
I’m passing “decode_data=False” as an argument to get_data, because I want the original jp2 files.
After the get_data method returns, I try opening the file but I’m unable to extract the data properly.
I’ve tried both of the following methods, and each fails in a different way:
rasterio.open(BytesIO(data.content)).
rasterio.open(data.content).

Can someone point me in the right direction?
Please note that I know how to download the numpy files - I don’t need help with that.
My issue is with getting the underlying jp2 file.

Thanks in advance!

P.S Note that I’m using Python 3.10 and rasterio 1.3.3

1 reply

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.