sentinel-hub / sentinelhub-py

Download and process satellite imagery in Python using Sentinel Hub services.
http://sentinelhub-py.readthedocs.io/en/latest/
MIT License
820 stars 249 forks source link

Minor Feature Request : : Download only Metafiles, when bands aren't specified #46

Closed akhildevelops closed 6 years ago

akhildevelops commented 6 years ago

Hi a small feature request, instead of downloading all the bands by default i.e, when bands are not explicitly passed as an argument. Download only Metafiles.

Example, for below code, download only the metafiles without including all the bands :

`metafiles = ['tileInfo', 'preview']

request = AwsTileRequest(tile=tile_name, time=time, aws_index=aws_index, metafiles=metafiles, data_folder=data_folder, data_source=DataSource.SENTINEL2_L1C)

request.save_data()`

AleksMat commented 6 years ago

This is actually already possible (although it is not well documented). Class sentinelhub.constants.AwsConstants contains all filenames used for download. Therefore you can download only metafiles with:

from sentinelhub import AwsTileRequest, AwsConstants

request = AwsTileRequest(tile=tile_name, time=time, aws_index=aws_index,
    bands=[],
    metafiles=AwsConstants.S2_L1C_METAFILES, 
    data_folder=data_folder,
    data_source=DataSource.SENTINEL2_L1C)

request.save_data()

By the way, if you download data in same structure as available at AWS we figured the best default option is to download all bands and no metadata. That is because in most use cases only bands are needed. However if you download into .SAFE format (specified with safe_format=True) the default option is to download all metadata as well (except for tileInfo.json and productInfo.json which are not part of the .SAFE structure).

AleksMat commented 6 years ago

Closing the issue for now, we will keep in mind to add some more examples about this in the future.