|
| 1 | +# Contributing |
| 2 | + |
| 3 | +Thank you for helping build CubeDynamics! This project keeps climate cube math lightweight, streaming-first, and well documented. |
| 4 | + |
| 5 | +## Repository layout |
| 6 | + |
| 7 | +```text |
| 8 | +src/ |
| 9 | + cubedynamics/ |
| 10 | + __init__.py # re-exports verbs and pipe helpers |
| 11 | + piping.py # Pipe class + helpers |
| 12 | + ops/ |
| 13 | + __init__.py |
| 14 | + transforms.py # anomaly, month_filter, NDVI helpers |
| 15 | + stats.py # variance, correlation_cube, rolling metrics |
| 16 | + io.py # to_netcdf and future exporters |
| 17 | +docs/ # MkDocs + Material site |
| 18 | +``` |
| 19 | + |
| 20 | +Tests live under `tests/` and rely on `pytest`. Documentation is built with MkDocs (Material theme); run `mkdocs serve` while editing docs. |
| 21 | + |
| 22 | +## Local setup |
| 23 | + |
| 24 | +1. Fork or branch from `main` and create feature branches for your work. |
| 25 | +2. Install dependencies in editable mode (e.g., `python -m pip install -e .[dev]` once extras are defined). |
| 26 | +3. Run `pytest` plus any relevant notebooks/scripts before opening a pull request. |
| 27 | + |
| 28 | +## Adding a new verb |
| 29 | + |
| 30 | +1. Create the implementation in `cubedynamics/ops/`. |
| 31 | +2. Follow the factory pattern: |
| 32 | + |
| 33 | + ```python |
| 34 | + def verb_name(...): |
| 35 | + def _inner(cube): |
| 36 | + ... |
| 37 | + return _inner |
| 38 | + ``` |
| 39 | + |
| 40 | +3. Re-export the verb in `cubedynamics/verbs/__init__.py` (and optionally `cubedynamics/__init__.py`) so users can `from cubedynamics import verbs as v` and call `v.verb_name` directly. |
| 41 | +4. Document the new function under `docs/reference/verbs_*.md` and add examples using the pipe syntax. |
| 42 | +5. Write tests that cover direct invocation and pipe usage. |
| 43 | + |
| 44 | +## Streaming philosophy |
| 45 | + |
| 46 | +- **Streaming-first** – functions should operate on iterables, chunked dask arrays, or lazy `xarray` objects whenever possible. |
| 47 | +- **Side-effect aware** – avoid downloading entire archives; expose hooks for caching and resuming streams. |
| 48 | +- **Composable** – keep verbs pure (no global state) so they chain cleanly in the pipe system. |
| 49 | + |
| 50 | +## Docs + website |
| 51 | + |
| 52 | +- Keep the navigation structure in `mkdocs.yml` aligned with the docs files. |
| 53 | +- Use the new section layout (Concepts, Getting Started, Examples, Verbs Reference, Related Work, Development) when adding content. |
| 54 | +- Remember that Lexcube widgets do not render on the static site; include screenshots or Binder links where appropriate. |
| 55 | + |
| 56 | +## Opening a pull request |
| 57 | + |
| 58 | +- Describe the change, test coverage, and any data access requirements. |
| 59 | +- Update the [Roadmap](roadmap.md) or [Changelog](changelog.md) when user-facing features ship. |
| 60 | +- Issues and discussions are welcome for roadmap ideas, new data sources, or Lexcube visualizations. |
0 commit comments