sentinelhub.aws.data
Module for defining how satellite data will be collected from AWS and where it will be saved.
- class sentinelhub.aws.data.AwsData(parent_folder='', bands=None, metafiles=None, config=None)[source]
Bases:
object
A base class for collecting satellite data from AWS.
- Parameters:
parent_folder (str) – Folder where the fetched data will be saved.
bands (None | str | List[str]) – List of Sentinel-2 bands for request. If parameter is set to None all bands will be used.
metafiles (None | str | List[str]) – List of additional metafiles available on AWS (e.g.
['metadata', 'tileInfo', 'preview/B01', 'TCI']
). If parameter is set to None the list will be set automatically.config (SHConfig | None) – A custom instance of config class to override parameters from the saved configuration.
- abstract get_requests()[source]
Abstract class for joining together download requests
- Return type:
Tuple[List[DownloadRequest], List[str]]
- get_safe_type()[source]
Determines the type of ESA product.
In 2016 ESA changed structure and naming of data. Therefore, the class must distinguish between old product type and compact (new) product type.
- Returns:
type of ESA product
- Raises:
ValueError
- Return type:
- get_baseline()[source]
Determines the baseline number (i.e. version) of ESA .SAFE product
- Returns:
baseline number
- Raises:
ValueError
- Return type:
- sort_download_list()[source]
Method for sorting the list of download requests. Band images have priority before metadata files. If bands images or metadata files are specified with a list they will be sorted in the same order as in the list. Otherwise, they will be sorted alphabetically (band B8A will be between B08 and B09).
- Return type:
None
- structure_recursion(struct, folder)[source]
From nested dictionaries representing .SAFE structure it recursively extracts all the files that need to be downloaded and stores them into class attribute download_list.
- static add_file_extension(filename, data_format=None, remove_path=False)[source]
Joins filename and corresponding file extension if it has one.
- class sentinelhub.aws.data.AwsProduct(*args, **kwargs)[source]
Bases:
AwsData
Class for collecting Sentinel-2 products data from AWS.
- Parameters:
parent_folder – Folder where the fetched data will be saved.
bands – List of Sentinel-2 bands for request. If parameter is set to None all bands will be used.
metafiles – List of additional metafiles available on AWS (e.g.
['metadata', 'tileInfo', 'preview/B01', 'TCI']
). If parameter is set to None the list will be set automatically.config – A custom instance of config class to override parameters from the saved configuration.
args (Any) –
kwargs (Any) –
- get_requests()[source]
Creates product structure and returns list of files for download.
- Returns:
List of download requests and list of empty folders that need to be created
- Return type:
Tuple[List[DownloadRequest], List[str]]
- get_data_collection()[source]
The method determines data collection from product ID.
- Returns:
Data collection of the product
- Raises:
ValueError
- Return type:
- class sentinelhub.aws.data.AwsTile(*args, **kwargs)[source]
Bases:
AwsData
Class for collecting Sentinel-2 tiles data from AWS.
- Parameters:
parent_folder – Folder where the fetched data will be saved.
bands – List of Sentinel-2 bands for request. If parameter is set to None all bands will be used.
metafiles – List of additional metafiles available on AWS (e.g.
['metadata', 'tileInfo', 'preview/B01', 'TCI']
). If parameter is set to None the list will be set automatically.config – A custom instance of config class to override parameters from the saved configuration.
args (Any) –
kwargs (Any) –
- get_requests()[source]
Creates tile structure and returns list of files for download.
- Returns:
List of download requests and list of empty folders that need to be created
- Return type:
Tuple[List[DownloadRequest], List[str]]
- get_aws_index()[source]
Returns tile index on AWS. If tile_index was not set during class initialization it will be determined according to existing tiles on AWS.
- Returns:
Index of tile on AWS
- Return type:
- tile_is_valid()[source]
Checks if tile has tile info and valid timestamp
- Returns:
True if tile is valid and False otherwise
- Return type:
- get_tile_info()[source]
Collects basic info about tile from tileInfo.json.
- Returns:
dictionary with tile information
- Return type: