Orchestrator

Prep orchestrator — chains all forcing processors in sequence.

Replaces exnos_ofs_prep.sh (~800 lines of shell) with a Python pipeline.

Usage:

from nos_utils.config import ForcingConfig
from nos_utils.orchestrator import PrepOrchestrator

config = ForcingConfig.for_secofs(pdy="20260324", cyc=12)
orch = PrepOrchestrator(config, paths={
    "gfs": "/data/gfs/v16.3",
    "hrrr": "/data/hrrr/v4.1",
    "nwm": "/data/nwm/v3.0",
    "rtofs": "/data/rtofs/v2.5",
    "fix": "/data/fix/secofs",
    "output": "/data/work/secofs",
    "comout": "/data/comout/secofs",
})
results = orch.run(phase="nowcast")
class nos_utils.orchestrator.PrepResult(success: bool, phase: str, results: List[ForcingResult] = <factory>, elapsed_seconds: float = 0.0)[source]

Bases: object

Result from a full prep orchestration run.

success: bool
phase: str
results: List[ForcingResult]
elapsed_seconds: float = 0.0
property all_output_files: List[Path]
property all_errors: List[str]
property all_warnings: List[str]
summary() → str[source]
class nos_utils.orchestrator.PrepOrchestrator(config: ForcingConfig, paths: Dict[str, str], run_name: str = 'secofs', skip_legacy: bool = True)[source]

Bases: object

Chains all forcing processors for a complete SCHISM prep cycle.

Steps: 1. Hotstart — find restart file, determine ihot and time_hotstart 2. GFS — primary atmospheric forcing (sflux_air/rad/prc stack 1) 3. HRRR — secondary atmospheric (sflux stack 2, optional) 4. NWM — river forcing (vsource.th, msource.th, source_sink.in) 5. RTOFS — ocean boundary (elev2D.th.nc, TEM_3D.th.nc, SAL_3D.th.nc, uv3D.th.nc) 6. Tidal — tidal constituents (bctides.in) 7. param.nml — model configuration with runtime parameters 8. (UFS only) DATM blending + ESMF mesh generation

PYTHON_STEPS = {'datm', 'gfs', 'hotstart', 'hrrr', 'param_nml', 'tidal'}
LEGACY_STEPS = {'nudging', 'nwm', 'rtofs'}
property is_stofs: bool

True if running STOFS-3D-ATL (detected from run_name or config).

run(phase: str = 'nowcast') → PrepResult[source]

Run the full prep pipeline.

Parameters:

phase – “nowcast”, “forecast”, or “full” (nowcast + forecast)

Returns:

PrepResult with all processor results

archive_to_comout(result: PrepResult, comout: Path) → List[Path][source]

Archive prep outputs to COMOUT with NCO naming convention.

Creates tars for sflux and OBC, copies individual files for param.nml, bctides.in, source_sink.in, etc.

Parameters:
  • result – PrepResult from run()

  • comout – COMOUT directory path

Returns:

List of archived file paths