Subset Harmony Module

subset_harmony.py

Implementation of harmony-service-lib that invokes the Level 2 subsetter.

exception podaac.subsetter.subset_harmony.L2SSException(original_exception)[source]

L2SS Exception class for custom error messages to see in harmony api calls.

__init__(original_exception)[source]
class podaac.subsetter.subset_harmony.L2SubsetterService(message, catalog=None, config=None)[source]

See https://github.com/nasa/harmony-service-lib-py for documentation and examples.

__init__(message, catalog=None, config=None)[source]

Constructs the adapter

Parameters:
  • message (harmony_service_lib.Message) – The Harmony input which needs acting upon

  • catalog (pystac.Catalog) – A STAC catalog containing the files on which to act

  • config (harmony_service_lib.util.Config) – The configuration values for this runtime environment.

cmd(*args) List[str][source]

Logs and then runs command.

Parameters:

run (args Command and args to)

Return type:

Command output

prepare_output_dir(output_dir: str) None[source]

Deletes (if present) and recreates the given output_dir, ensuring it exists and is empty

Parameters:

output_dir (string) – the directory to delete and recreate

process_item(item: Item, source: Source) Item[source]

Performs variable and bounding box subsetting on the input STAC Item’s data, returning an output STAC item

Parameters:
  • item (pystac.Item) – the item that should be subset

  • source (harmony.message.Source) – the input source defining the variables, if any, to subset from the item

Returns:

a STAC item describing the output of the subsetter

Return type:

pystac.Item

podaac.subsetter.subset_harmony.harmony_to_podaac_bbox(bbox: list) ndarray[source]

Convert Harmony bbox (west, south, east, north) to PO.DAAC bbox ((west, east), (south, north))

Parameters:

bbox (list) – Harmony bbox

Returns:

PO.DAAC bbox

Return type:

np.array

podaac.subsetter.subset_harmony.main(config: Config | None = None) None[source]

Parse command line arguments and invoke the service to respond to them.

Parameters:

config (harmony.util.Config)

Return type:

None

podaac.subsetter.subset_harmony.podaac_to_harmony_bbox(bbox: ndarray) ndarray | float[source]

Convert PO.DAAC bbox ((west, east), (south, north)) to Harmony bbox (west, south, east, north)

Parameters:

bbox (np.array) – Podaac bbox

Returns:

  • array, int or float – Harmony bbox

  • TODO - fix this docstring type, type hint, and code to match (code currently returns a list)