hypso.ac.adapters#

Subprocess drivers for the external atmospheric-correction tools (_polymer_driver, _acolite_driver) and run_subprocess_driver/ACRunError (base.py). Each tool runs in its own process; see base.py for why.

Submodules#

Exceptions#

ACRunError

A subprocess-isolated AC tool run failed. Carries the subprocess's raw

Functions#

run_subprocess_driver(python_path, driver_module, ...)

Run driver_module (a hypso.ac.adapters._*_driver module with a

Package Contents#

exception hypso.ac.adapters.ACRunError(tool, returncode, stdout, stderr, error_type=None, message=None)[source]#

Bases: RuntimeError

A subprocess-isolated AC tool run failed. Carries the subprocess’s raw stdout/stderr and, if its driver script produced a structured result.json before failing, that error’s type/message/traceback from the tool’s own process - so a caller sees why (e.g. “eoread not on this interpreter’s path”) instead of just “subprocess exited 1”.

Initialize self. See help(type(self)) for accurate signature.

Parameters:
hypso.ac.adapters.run_subprocess_driver(python_path, driver_module, config, tool_name, extra_env=None)[source]#

Run driver_module (a hypso.ac.adapters._*_driver module with a python -m-invocable __main__ block) in a fresh subprocess under python_path, passing it config as JSON and reading back its JSON result. Config/result files live in a per-call TemporaryDirectory (not a shared/fixed path) so concurrent runs never collide - the exact class of bug hypso-processing-pipeline had to work around by hand for OC-SMART’s staging directory.

python_path defaults to sys.executable at the call site (the same interpreter this process is running under) when the caller doesn’t need a genuinely separate environment - that interpreter must have hypso importable for any driver whose tool resolves a hook by dotted string name back into this package (e.g. Polymer’s srf_getter).

extra_env, if given, is merged into the subprocess’s environment (on top of this process’s own os.environ) - the mechanism for passing secrets (e.g. ACOLITE’s EARTHDATA credentials) to a driver WITHOUT writing them into config.json, which lives on disk (even briefly, even in a private TemporaryDirectory) for the run’s duration.

Raises ACRunError on any failure (non-zero exit, missing/unparseable result.json, or a result.json reporting status != “ok”); returns the parsed result dict on success.

Parameters:
  • python_path (str)

  • driver_module (str)

  • config (dict)

  • tool_name (str)

  • extra_env (dict)

Return type:

dict