merger.harmony package

Submodules

merger.harmony.cli module

A Harmony CLI wrapper around Concise

merger.harmony.cli.main(config=None)[source]

Main Harmony CLI entrypoint

merger.harmony.download_worker module

A utility for downloading multiple granules simultaneously

merger.harmony.download_worker.multi_core_download(urls, destination_dir, access_token, cfg, process_count=None)[source]

A method which automagically scales downloads to the number of CPU cores. For further explaination, see documentation on “multi-track drifting”

Parameters
  • urls (list) – list of urls to download

  • destination_dir (str) – output path for downloaded files

  • access_token (str) – access token as provided in Harmony input

  • cfg (dict) – Harmony configuration information

  • process_count (int) – Number of worker processes to run (expected >= 1)

Returns

list of downloaded files as pathlib.Path objects

Return type

list

merger.harmony.service module

A Harmony service wrapper around the Concise module

class merger.harmony.service.ConciseService(message, catalog=None, config=None)[source]

Bases: harmony.adapter.BaseHarmonyAdapter

A harmony-service-lib wrapper around the Concise module. This wrapper does not support Harmony calls that do not have STAC catalogs as support for this behavior is being depreciated in harmony-service-lib

invoke()[source]

Primary entrypoint into the service wrapper. Overrides BaseHarmonyAdapter.invoke

process_catalog(catalog: pystac.catalog.Catalog)[source]

Recursively process a catalog and all its children. Adapted from BaseHarmonyAdapter._process_catalog_recursive to specfifically support our particular use case for many-to-one

Parameters

catalog (pystac.Catalog or pystac.Collection) – a catalog/collection to process for merging

Returns

A new catalog containing the results from the merge

Return type

pystac.Catalog

merger.harmony.util module

Misc utility functions

merger.harmony.util.get_bbox(item, current_bbox)[source]

Accumulate bboxes from items to generate a bbox which encompasses all items

Parameters
  • item (pystac.Item) – an item to process

  • current_bbox (list) – the bbox to accumulate all items to

merger.harmony.util.get_datetime(item, datetimes)[source]

Accumulate datetimes from items to generate a datetime pair that encompasses all items

Parameters
  • item (pystac.Item) – an item to process

  • datetimes (list) – datetime pair to accumulate to; first element is start_datetime, second is end_datetime

merger.harmony.util.get_granule_url(item, granule_urls, strict=True)[source]

Processes an item to find a netcdf4-python compatible asset. If no asset is found, a RuntimeException is thrown

Parameters
  • item (pystac.Item) – an item to process

  • granule_urls (list) – list to append the asset’s url to

merger.harmony.util.is_netcdf_asset(asset, strict)[source]

Determine if an asset is netcdf4-python compatible. netcdf4-python currently supports HDF5, NetCDF3, and NetCDF4. Determination is currently done through MIME if strict mode is enabled. If strict mode is not enabled, determination is done through ‘data’ role.

Parameters

asset (pystac.Asset) – an asset to check

Returns

True if netcdf4-python compatible; False otherwise

Return type

bool

Module contents