ukis_pysat.data

class ukis_pysat.data.Source(datahub, catalog=None)

Bases: object

Provides methods to query data sources for metadata and download images and quicklooks (APIs only). Remote APIs and local data directories that hold metadata files are supported.

Parameters:
  • datahub – Data source (<enum ‘Datahub’>).
  • catalog – Only applicable if datahub is ‘STAC_local’. Can be one of the following types: Path to STAC Catalog file catalog.json (String, Path). Pystac Catalog or Collection object (pystac.catalog.Catalog, pystac.collection.Collection). None initializes an empty catalog. (default: None)
add_items_from_directory(item_dir, item_glob='*.json')

Adds STAC items from a directory to a STAC Catalog.

Parameters:
  • item_dir – Path to directory that holds the STAC items (String).
  • item_glob – Optional glob pattern to identify STAC items in directory (String), (default: ‘*.json’).
close()

Closes connection to or logs out of Datahub.

construct_metadata(meta, platform)

Constructs a STAC item that is harmonized across the different satellite image sources.

Parameters:
  • meta – Source metadata (GeoJSON-like mapping)
  • platform – Image platform (<enum ‘Platform’>).
Returns:

PySTAC item

download_image(product_uuid, target_dir)

Downloads satellite image data to a target directory for a specific product_id. Incomplete downloads are continued and complete files are skipped.

Parameters:
  • product_uuid – UUID of the satellite image product (String).
  • target_dir – Target directory that holds the downloaded images (String, Path)
download_quicklook(product_uuid, target_dir)

Downloads a quicklook of the satellite image to a target directory for a specific product_id. It performs a very rough geocoding of the quicklooks by shifting the image to the location of the footprint.

Parameters:
  • product_uuid – UUID of the satellite image product (String).
  • target_dir – Target directory that holds the downloaded images (String, Path)
query_metadata(platform, date, aoi, cloud_cover=None, kwargs=None)

Queries metadata from data source.

Parameters:
  • platform – Image platform (<enum ‘Platform’>).
  • date – Date from - to in format yyyyMMdd (String or Datetime tuple).
  • aoi – Area of interest as GeoJson file or bounding box tuple with lat lon coordinates (String, Tuple).
  • cloud_cover – Percent cloud cover scene from - to (Integer tuple) (default: None).
  • kwargs – Dictionary of the additional requirements for the hub used (default: None).
Generates:

Metadata item of products that match query criteria (PySTAC item).

query_metadata_srcid(platform, srcid)

Queries metadata from data source by srcid.

Parameters:
  • platform – Image platform (<enum ‘Platform’>).
  • srcid – Srcid of a specific product (String).
Generates:

Metadata of product that matches srcid (PySTAC item).

stream_image(product_uuid)
Parameters:product_uuid – UUID of the satellite image product (String).
Returns:response