Alaska Satellite Facility (ASF) Class

class terragon.alaska_satellite_facility.ASF(credentials={})

Bases: Base

Class to interact with the Alaska Satellite Facility (ASF). This class provides functionality to search for, download, and process satellite imagery from ASF. It downloads complete image tiles via HTTP into a temporary folder and subsequently crops, reprojects, and aligns the imagery to match a given shapefile. The processing pipeline leverages several libraries including asf_search, rasterio, rioxarray, xarray, pandas, and joblib to facilitate efficient parallel processing.

Currently, the following satellite data collections are supported: SENTINEL-1, ALOS PALSAR, and ALOS AVNIR-2.

Parameters:

credentials (dict) – A dictionary for ASF authentication. Expected format: {‘asf_username’: <username>, ‘asf_password’: <pwd>}.

download(items)

Download the items from Alaska Satellite Facility as xr.Dataset or download the files.

Parameters:

items – List of ASF items to download.

Returns:

An xarray.Dataset if the ‘create_minicube’ parameter is True; otherwise, a list of file paths to the TIFF files.

Raises:

ValueError – If no items are provided for download.

retrieve_collections(query={}, fields=[])

Search the collections provided by the Alaska Satellite Facility. ASF does only support the titles of the collections.

Parameters:
  • query (dict) – query to filter the title ‘{title:<regex>}’, defaults to {}

  • fields (list[str]) – unused

Raises:

RuntimeError – If the request to the collections endpoint fails.

Return type:

list

Returns:

a list of collection names

search(*args, rm_tmp_files=True, resampling=Resampling.nearest, **kwargs)

Search for items in the Alaska Satellite Facility collections, return the items and their meta data, and store the parameters in the class in order to access them later in the download function.

Parameters:
  • rm_tmp_files – Remove downloaded temporary files after creating the data cube, defaults to True.

  • resampling – Resampling method to use when reprojecting images, defaults to rasterio.enums.Resampling.nearest.

  • args/kwargs – Parameters which are handled by the parent class, these parameters are the same for all data providers. See the ‘Base’ class for more information.

Raises:

ValueError – If no items are found for the given search parameters.

Returns:

A list of ASF products (items).