landstac.download¶
Download helpers for LandsatLook asset HREFs.
This module provides small, focused functions to stream protected assets to disk using an authenticated requests.Session. It does not print or log credentials. Create the session via landstac.auth and pass it in.
Functions¶
- download_asset(href, session, out_path, chunk=1<<20)
Stream one asset to a local GeoTIFF.
- download_item_bands(item, session, bands, out_dir)
Download several bands for a single STAC item into a scene folder.
- stack_bands_to_geotiff(band_paths, out_path, order=None)
Stack single-band GeoTIFFs into a single multiband GeoTIFF.
Examples
>>> # sess = ers_login_from_file("credentials.json")
>>> # files = download_item_bands(item, sess, ["blue","green","red"], "downloads")
>>> # stack_bands_to_geotiff(files, "downloads/scene_stack.tif", order=["blue","green","red"])
Functions
|
Stream an asset to disk using an authenticated session. |
|
Download selected bands for a STAC item. |
|
Stack single-band GeoTIFFs into a multiband GeoTIFF. |
- landstac.download.download_asset(href, session, out_path, chunk=1048576)[source]¶
Stream an asset to disk using an authenticated session.
- Parameters:
- Returns:
The local path written.
- Return type:
- Raises:
DownloadError – On HTTP errors or authorization failures.
- landstac.download.download_item_bands(item, session, bands, out_dir)[source]¶
Download selected bands for a STAC item.
- Parameters:
item (pystac.Item) – STAC item from LandsatLook.
session (requests.Session) – Authenticated session to access protected assets.
bands (Iterable[str]) – Asset keys to download, for example [“blue”,”green”,”red”,”nir08”].
out_dir (str) – Root folder to save files. A per-scene subfolder is created.
- Returns:
Mapping {band_name: local_path} for the bands that were downloaded.
- Return type:
- landstac.download.stack_bands_to_geotiff(band_paths, out_path, order=None)[source]¶
Stack single-band GeoTIFFs into a multiband GeoTIFF.
All input rasters must share identical CRS, transform, width, and height.
- Parameters:
- Returns:
Path to the written multiband GeoTIFF.
- Return type:
- Raises:
ValueError – If georeferencing does not match across inputs.