src.core.downloader package¶
Submodules¶
src.core.downloader.AmazonBucketManager module¶
-
class
src.core.downloader.AmazonBucketManager.
AmazonBucketManager
(configurations)[source]¶ Bases:
object
This class is an Adapter of Amazon AWS services. Main goal of this class is Retrieve the list of products from aws via tile list, and time interval
-
extract_date
(item)[source]¶ This method extracts the date from the tile name string (complete with the date).
Parameters: item – The tile name complete string. e.g. tiles/32/T/MK/YYYY/MM/DD/
- where
- YYYY is the year
- MM is the month
- DD is the day
Returns: The extracted date form the tile name string Return type: Datetime The method apply the regex:
tiles/[0-9]2/[A-Z]/[A-Z]{2}/([0-9]{4})/([0-9]*)/([0-9]*)/
to the item parameter
-
generate_url
(tile, year)[source]¶ This method generates the aws url from the tile name string and the start year of filter interval. AWS service has the prefix parameter, to filter the list of available files in the bucket. This method generates the proper prefix parameter value, to give the list of files available in the year of year argument passed in the method.
The generated parameter is like:
prefix=tiles/{tile}/{year}/
Parameters: tile – The tile name string with a pattern like 32/T/MK
Parameters: year – The year Returns: request url Return type: String
-
get_products_list
(searchFilter)[source]¶ This method manages the retrieval of aws products. This method contains the AWS APIs semantic it is the core of Adapter. It manages also pagination.
Parameters: searchFilter (SearchFilter) – Search parameters to filter the available files in the bucket Returns: The pending products available in the Amazon bucket. Return type: None Todo
Optimize list retrieval using set end date year instead NOW year.
-
load_products
(tile, year, paginated=False)[source]¶ load_products load list products form the Amazon AWS Bucket of Sinergise Sentinel-2 on AWS. This method contains the AWS APIs semantic it is the core of Adapter. It manages also pagination.
Parameters: - tile (String) – Tile name
- year (Boolean) – Year of interest, the method extract the whole list of products for this year
- paginated – if this parameter is True that means that the list provided from AWS is paginated and the next page starts after the last_item
Returns: None
Return type: This method stores the list of products in the classes property product_list.
-
src.core.downloader.Configuration module¶
src.core.downloader.ConfigurationManager module¶
src.core.downloader.Datasource module¶
-
class
src.core.downloader.Datasource.
Datasource
(configurations)[source]¶ Bases:
object
This class is the datasource of all data used by the Downloader.
-
download_product
(product)[source]¶ This method donwloads the product passed as method paramenter.
Parameters: product (Product) – The product to download Returns: None Return type: None
-
get_products_list
(searchFilter)[source]¶ This method generates the product list from query filters defined in the config file by the user.
Parameters: searchFilter (SearchFilter) – Search parameters to filter the available files in the bucket Returns: The list of available products. Return type: List
-
src.core.downloader.Downloader module¶
-
class
src.core.downloader.Downloader.
Downloader
[source]¶ Bases:
object
The main class of Downloader module, it is the entry point that receives the trigger of download events.
-
create_search_filter
(tile)[source]¶ This method generates the SearchFilter object from the tile name and configurations set by user.
Parameters: tile (String) – Tile name Returns: Search filter object to retrieve data from datasource Return type: SearchFilter
-
src.core.downloader.DownloaderJob module¶
-
class
src.core.downloader.DownloaderJob.
DownloaderJob
(queue)[source]¶ Bases:
threading.Thread
This class manages the ProductDownloader classes. This is an async method, launched by the Downloader.