ascat.download namespace
Submodules
ascat.download.connectors module
HTTP and FTP download module.
- class ascat.download.connectors.Connector(base_url)[source]
Bases:
objectBase class for connecting and downloading from remote source.
- connect(credentials)[source]
Establish connection to remote source.
- Parameters:
credentials (dict) – Dictionary of needed authentication parameters.
- download_date_range(path, start_date, end_date)[source]
Fetch resource location for download of multiple files in date range.
- Parameters:
path (string) – Local directory, where found datasets are stored.
start_date (datetime) – Start date of date range interval.
end_date (datetime) – End date of date range interval.
- class ascat.download.connectors.EumConnector(base_url='https://api.eumetsat.int')[source]
Bases:
HttpConnectorClass for downloading from EUMETSAT via HTTP requests.
- connect(credentials)[source]
Establish connection to EUMETSAT.
- Parameters:
credentials (dict) – Dictionary of needed authentication parameters.
- download(product, local_path, start_date, end_date, max_workers=1, coords=None, limit=None)[source]
Fetch resource location for download of multiple files in daterange.
- Parameters:
product (string) – Product.
coords (list of float, optional) – Coordinates of polygon, where files will be downloaded
local_path (string) – Local directory, where found datasets are stored.
start_date (datetime) – Start date of date range interval.
end_date (datetime) – End date of date range interval.
max_workers (int, optional) – Number of parallel downloads (default: 1).
coords – A custom polygon using EPSG:4326 decimal degrees (default: None).
limit (int, optional) – Filter used to limit the returned results (default: None).
- class ascat.download.connectors.FtpConnector(base_url)[source]
Bases:
ConnectorClass for downloading via FTP
- connect(credentials)[source]
Establish connection to FTP source.
- Parameters:
credentials (dict) – Dictionary of needed authentication parameters.
- download_file(file_remote, file_local, overwrite=False)[source]
Download single file from passed url to local file
- Parameters:
file_remote (string) – path of file to download
file_local (string) – path (local) where to save file
overwrite (bool, optional) – If True, existing files will be overwritten.
- class ascat.download.connectors.HsafConnector(base_url='ftphsaf.meteoam.it')[source]
Bases:
FtpConnectorClass for downloading from HSAF via FTP.
- download(remote_path, local_path, start_date, end_date, limit=None, overwrite=False)[source]
Fetch resource location for download of multiple files in date range.
- Parameters:
remote_path (string) – Remote directory, where found datasets are stored.
local_path (string) – Local directory, where found datasets are stored.
start_date (datetime) – Start date of date range interval.
end_date (datetime) – End date of date range interval.
limit (int, optional) – Filter used to limit the returned results (default: 1).
overwrite (bool, optional) – If True, existing files will be overwritten.
- files(remote_path, start_date, end_date)[source]
Generator retrieving file list for given date range.
- Parameters:
remote_path (string) – Remote directory, where found datasets are stored.
local_path (string) – Local directory, where found datasets are stored.
start_date (datetime) – Start date of date range interval.
end_date (datetime) – End date of date range interval.
- Yields:
matches (list) – List of daily files.
- class ascat.download.connectors.HttpConnector(base_url)[source]
Bases:
ConnectorClass for http requests.
- download_file(file_remote, file_local, overwrite=False, n_retry=5)[source]
Download single file from passed url to local file.
- Parameters:
file_remote (string) – Path of file to download
file_local (string) – Path (local) where to save file
overwrite (bool, optional) – If True, existing files will be overwritten.
- ascat.download.connectors.concurrent_download(download_func, download_url_list, local_file_list, max_workers=1)[source]
Threaded file download.
- ascat.download.connectors.str2path(path)[source]
Convert str path to pathlib.Path object.
- Parameters:
path (str, pathlib.Path) – Path.
- Returns:
path – Pathlib path.
- Return type:
ascat.download.interface module
Download interface.
- ascat.download.interface.eumetsat_download(credentials, product, local_path, start_date, end_date, max_workers=1, coords=None, limit=None)[source]
Function to start EUMETSAT download.
- Parameters:
credentials (dict) – Dictionary of needed authentication parameters (‘user’, ‘password’).
remote_path (string) – Remote directory, where found datasets are stored.
local_path (string) – Local directory, where found datasets are stored.
start_date (datetime) – Start date of date range interval.
end_date (datetime) – End date of date range interval.
max_workers (int, optional) – Number of parallel downloads (default: 1).
coords (list of float, optional) – A custom polygon using EPSG:4326 decimal degrees (default: None).
limit (int, optional) – Filter used to limit the returned results (default: None).
- ascat.download.interface.eumetsat_main(cli_args)[source]
Command line interface routine.
- Parameters:
cli_args (list) – Command line arguments.
- ascat.download.interface.hsaf_download(credentials, remote_path, local_path, start_date, end_date, limit=None)[source]
Function to start H SAF download.
- Parameters:
credentials (dict) – Dictionary of needed authentication parameters (‘user’, ‘password’).
remote_path (string) – Remote directory, where found datasets are stored.
local_path (string) – Local directory, where found datasets are stored.
start_date (datetime) – Start date of date range interval.
end_date (datetime) – End date of date range interval.
limit (int, optional) – Filter used to limit the returned results (default: 1).
- ascat.download.interface.hsaf_main(cli_args)[source]
Command line interface routine.
- Parameters:
cli_args (list) – Command line arguments.
- ascat.download.interface.parse_args_eumetsat_download(args)[source]
Parse command line arguments.
- Parameters:
args (list) – Command line arguments.
- Returns:
args (list) – Parsed arguments.
parser (ArgumentParser) – Argument Parser object.
- ascat.download.interface.parse_args_hsaf_download(args)[source]
Parse command line arguments.
- Parameters:
args (list) – Command line arguments.
- Returns:
args (list) – Parsed arguments.
parser (ArgumentParser) – Argument Parser object.
- ascat.download.interface.parse_date(s)[source]
Convert date string into datetime timestamp.
- Parameters:
s (str) – Date string.
- Returns:
data – Timestamp.
- Return type:
datetime