NCO Bridge

NCO environment variable bridge.

Reads standard NCO/ecFlow environment variables (PDY, cyc, COMINgfs, etc.) and constructs a ForcingConfig + paths dict for the PrepOrchestrator.

This is the glue between the operational HPC job environment and nos-utils.

Usage from shell:

export PYTHONPATH=/path/to/nos-utils:$PYTHONPATH
python3 -c "
    from nos_utils.nco_bridge import config_from_env, run_prep
    run_prep(phase='nowcast')
"

Usage from Python:

from nos_utils.nco_bridge import config_from_env
config, paths = config_from_env()
nos_utils.nco_bridge.config_from_env(ofs_override: str | None = None, yaml_override: str | None = None) → Tuple[ForcingConfig, Dict[str, str]][source]

Build ForcingConfig + paths dict from NCO environment variables.

Environment variables read:

PDY, cyc — Production date and cycle RUN — OFS name (secofs, stofs_3d_atl, etc.) OFS_CONFIG — Path to YAML config file (optional) COMINgfs, COMINhrrr, COMINrtofs, COMINnwm — Input data paths FIXofs — Fix file directory DATA — Working directory COMOUT — Output archive directory COMIN — Previous cycle output (for hotstart) USE_DATM — “true” for UFS-Coastal mode (nws=4)

Returns:

(ForcingConfig, paths_dict)

nos_utils.nco_bridge.run_prep(phase: str = 'nowcast', ofs: str | None = None, skip_legacy: bool = True) → bool[source]

Run the prep orchestrator using NCO environment variables.

Convenience function for calling from shell scripts.

Parameters:
  • phase – “nowcast”, “forecast”, or “full”

  • ofs – OFS name override

  • skip_legacy – If True (default), skip OBC/river (handled by legacy shell). Set False to run all steps including Python OBC/river.

Returns:

True if successful