Metadata-Version: 2.4
Name: cdo-flow
Version: 0.2.0
Summary: Workflow orchestration layer for CDO-based climate analysis
Author-email: Naren Karthik B M <narenkarthikbm@gmail.com>
License: MIT
Keywords: cdo,climate,netcdf,orchestration,workflow
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Atmospheric Science
Requires-Python: >=3.10
Requires-Dist: click>=8.0
Requires-Dist: pydantic>=2.0
Requires-Dist: python-cdo-wrapper>=1.1
Requires-Dist: pyyaml>=6.0
Requires-Dist: rich>=13.0
Requires-Dist: textual>=0.50
Provides-Extra: dev
Requires-Dist: mypy; extra == 'dev'
Requires-Dist: pytest; extra == 'dev'
Requires-Dist: pytest-cov; extra == 'dev'
Requires-Dist: pytest-mock; extra == 'dev'
Requires-Dist: ruff; extra == 'dev'
Provides-Extra: hpc
Requires-Dist: dask-jobqueue; extra == 'hpc'
Provides-Extra: shapefile
Requires-Dist: geopandas; extra == 'shapefile'
Requires-Dist: shapely; extra == 'shapefile'
Provides-Extra: snakemake
Requires-Dist: snakemake; extra == 'snakemake'
Description-Content-Type: text/markdown

# cdo-flow

Workflow orchestration layer for CDO-based climate analysis, built on top of [python-cdo-wrapper](https://pypi.org/project/python-cdo-wrapper/).

## Install

```bash
pip install cdo-flow
```

Requires [CDO](https://mpimet.mpg.de/cdo) to be installed for steps that execute CDO operators.

## Quick start

```python
from cdo_flow import Workflow, python_step, cdo_step
from python_cdo_wrapper.query import CDOQueryTemplate

# Pure Python step
@python_step
def write_data(ctx):
    ctx.output("result.txt").write_text("hello")

# CDO step via decorator
@cdo_step
def regrid(ctx, cdo):
    cdo.query(ctx.inputs["data"]).remap_bil("r360x180").to_file(ctx.output("regridded.nc"))

# Inline CDO chain
wf = Workflow(name="demo", run_dir="./runs")
wf.add_step("write", write_data)
wf.add_step(
    "select_tas",
    chain=CDOQueryTemplate().select_var("tas").year_mean(),
    inputs={"data": "/path/to/input.nc"},
    output=["tas_annual.nc"],
)
result = wf.run()
```

## YAML workflows

```yaml
name: my_workflow
steps:
  - id: select
    type: cdo
    inputs:
      data: /path/to/input.nc
    operator_chain:
      - op: selname
        args: [tas]
      - op: yearmean
    output: tas_annual.nc
```

```bash
cdo-flow validate my_workflow.yml
cdo-flow run my_workflow.yml --dry-run
cdo-flow run my_workflow.yml
```

## License

MIT
