## Goal Transform the existing CLI into a complete, modular, four-stage pipeline: ``` [ Acquisition (Ingest) ] → [ Processing ] → [ Visualization ] → [ Decimation (Egress) ] ``` - Rename `acquisition/` to `connectors/` to reflect both inbound and outbound data flow. - Split into `ingest/` and `egress/` submodules, sharing common backend code in `backends/`. - Each stage has its own CLI subcommands. - All commands accept stdin/stdout for chaining. - Add `run` command to execute pipelines from YAML/JSON config files. --- ## 1. Refactor CLI Structure ### 1.1 Top-Level Groups - Modify `src/zyra/cli.py`: - Create **four top-level subparsers**: `acquire`, `process`, `visualize`, `decimate`, plus `run`. - Remove existing flat commands (`decode-grib2`, `convert-format`, etc.) and nest under `process`. ### 1.2 Module Self-Registration - In each stage's `__init__.py`, add: ```python def register_cli(subparsers): """Register CLI commands for this stage.""" ``` - `cli.py` calls: ```python from zyra.connectors import ingest, egress from zyraimport processing, visualization ingest.register_cli(acquire_subparser) processing.register_cli(process_subparser) visualization.register_cli(visualize_subparser) egress.register_cli(decimate_subparser) ``` --- ## 2. Connectors Module Structure ``` src/zyra/connectors/ backends/ s3.py http.py ftp.py vimeo.py ingest/ __init__.py ingest_manager.py egress/ __init__.py egress_manager.py ``` ### 2.1 Ingest - `ingest_manager.py` maps CLI commands to inbound fetchers: - `acquire http ` → `backends/http.py` - `acquire s3 /` → `backends/s3.py` - `acquire ftp /` → `backends/ftp.py` - `acquire vimeo ` → `backends/vimeo.py` - All commands: - Accept `--output` (default `-` = stdout). - Stream binary data directly. ### 2.2 Egress - `egress_manager.py` maps CLI commands to outbound writers: - `decimate local ` - `decimate s3 /` → `backends/s3.py` - `decimate ftp /` → `backends/ftp.py` - `decimate post ` → `backends/http.py` - All commands: - Accept stdin (`-`) as input. - Write binary data directly. --- ## 3. Processing (`src/zyra/processing/`) - Move existing CLI functions into `process` namespace: - `decode-grib2` - `extract-variable` - `convert-format` - Add missing processors: - NetCDF subset/extract - Video conversion - All commands: - Accept stdin/stdout. - Auto-detect formats. --- ## 4. Visualization (`src/zyra/visualization/`) - New commands: - `visualize plot --type contour|timeseries --var ` - `visualize colormap --set ` - `visualize animate --frames --output