Skip to main content

How do I download each band into a separate TIFF file? The Wcs Request below downloads all bands at the specified spatial resolution set by the ‘resx’ and ‘resy’ parameters and outputs just one single TIFF with all bands. Ideally, I would like to have 13 TIFF files which all have the spatial resolution native to that band. For example, a TIFF for band 1 (with 60m resolution), a TIFF for band 3 (with 10m resolution), and so on. Please let me know if there is a way to do this with Sentinel Hub API, or any other technologies. Thanks!


from sentinelhub import WcsRequest, MimeType


full_res_request = WcsRequest(

data_folder=r’C:\Users…\sentinelhub’,

layer=‘BANDS-S2-L1C’,

bbox=bbox_list_shorto0],

resx=‘10m’,

resy=‘10m’,

time=(‘2017-06-01’, ‘2017-06-14’),

image_format=MimeType.TIFF_d32f,

config=config

)

full_res_request = full_res_request.get_data(save_data=True)

Hi @mcrichton.mitre,


I don’t know your use-case, but I typically rely on SentinelHub services to give me data at same resolution, so that I don’t have to upsample/downsample later on myself.


In any case, to get from single 13-band tiff to 13 single-band tiffs you can use gdal, e.g.


gdal_translate -b 1 all_bands.tif b1.tif

If you insist on getting original resolutions, then you’ll have to make several requests to SentinelHub service, one request per resolution, and define either new layer using configuration utility on your dashboard, or create evalscripts and add them to WcsRequest.


Another option is to use SH’s Processing Api, where output from service can merge several tiff files into tar. See for instance these docs.

It is possible to use sentinelhub-py with Processing Api, see examples here, particularly the part about " Downloading multiple responses as a TAR archive".


Hope this helps,

Matej


@batic Thanks for the reply! I’ll definitely check out the resources you linked to.


Reply