From bfe27d8425f816b28811e7a22541d8ea1fd54cff Mon Sep 17 00:00:00 2001 From: Abhaas Goyal Date: Wed, 24 Jan 2024 15:34:48 +1100 Subject: [PATCH] Add documentation - relevant packages to use for developers --- docs/dev_docs.md | 69 ++++++++++++++++++++++++++++++++++++++++++++++++ mkdocs.yml | 2 ++ 2 files changed, 71 insertions(+) create mode 100644 docs/dev_docs.md diff --git a/docs/dev_docs.md b/docs/dev_docs.md new file mode 100644 index 00000000..0137f8b2 --- /dev/null +++ b/docs/dev_docs.md @@ -0,0 +1,69 @@ +# Developer Guide +## Building +### Dependencies +- conda env +```sh +module load conda +conda env create --name benchcab-dev --file .conda/benchcab-dev.yaml +conda activate benchcab-dev +pip install --user -e . +``` + +### Dev-Dependencies +- `black`, `ruff`, `autoformatter` + +!!! tip + Add a docstring using numpy style. (autodocstring extension in VS Code can pre-populate for you, make sure to select numpy style on settings first). + +### Documentation +- mkdocs + +```sh +pip install -r mkdocs-requirements.txt +``` + +!!! tip + Using `mkdocs` on Gadi + Use ssh port forwarding + ```sh + ssh -L 8000:localhost:8000 @gadi.nci.org.au + ``` + +```sh +mkdocs serve +``` + +## Running + +Follow the user guide + +## Testing +- Static Type Checking `mypy` +- Unit tests `pytest` +- Integration tests +```sh +/bin/bash benchcab/data/test/integration.sh +``` + +### Comparing Models + +```sh +module load +``` + +Outputs are stored in `$SRC_DIR/runs/outputs/` + +- `netcdf` + +```sh +ncdump -h +``` + +- `nccmp`/`cdo` - Bitwise comparison + +```sh +cdo +``` + +!!! tip + Generally, try to keep a separate copy of `output2` from the `main` branch and `output1` from the feature branch to compare the ouputs, thus checking the validity of integration testing. \ No newline at end of file diff --git a/mkdocs.yml b/mkdocs.yml index a934c919..d4e962f2 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -75,7 +75,9 @@ nav: - About: index.md - User Guide: - user_guide/index.md + - user_guide/dev_docs.md - user_guide/config_options.md - user_guide/default_science_configurations.md - user_guide/running_CABLE_v2.md - user_guide/expected_output.md + - Developer Guide: dev_docs.md