-
Notifications
You must be signed in to change notification settings - Fork 2
Add documentation for zppy-interfaces #51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
00c51aa
Add Sphinx documentation pages
Copilot 8067cdf
Refine PCMDI docs wording
Copilot ec8d6bb
Add developer guide
forsyth2 eb6b62f
Split docs into user and developer guides
Copilot 84c8386
Revisions
forsyth2 be96162
Re-enable docs build
forsyth2 39422e0
Implement code review suggestions for docs and workflow
Copilot 736a4fb
Limit publish-docs token permissions
Copilot daab45c
Fix empty bullet cells in docs parameter tables
Copilot 84cdf14
Update testing instructions
forsyth2 6b35ba4
Address Copilot review comments
forsyth2 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| # Minimal makefile for Sphinx documentation | ||
| # | ||
|
|
||
| # You can set these variables from the command line. | ||
| SPHINXOPTS = | ||
| SPHINXBUILD = python -msphinx | ||
| SPHINXPROJ = zppy-interfaces | ||
| SOURCEDIR = source | ||
| BUILDDIR = _build | ||
|
|
||
| # Put it first so that "make" without argument is like "make help". | ||
| help: | ||
| @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) | ||
|
|
||
| .PHONY: help Makefile | ||
|
|
||
| # Catch-all target: route all unknown targets to Sphinx using the new | ||
| # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). | ||
| %: Makefile | ||
| @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| .wy-nav-content { | ||
| max-width: 1200px !important; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| {% extends "!layout.html" %} | ||
| {% block extrahead %} | ||
| <link href="{{ pathto("_static/style.css", True) }}" rel="stylesheet" type="text/css"> | ||
| {% endblock %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| {%- if current_version %} | ||
| <div class="rst-versions" data-toggle="rst-versions" role="note" aria-label="versions"> | ||
| <span class="rst-current-version" data-toggle="rst-current-version"> | ||
| <span class="fa fa-book"> Other Versions</span> | ||
| v: {{ current_version.name }} | ||
| <span class="fa fa-caret-down"></span> | ||
| </span> | ||
| <div class="rst-other-versions"> | ||
| {%- if versions.tags %} | ||
| <dl> | ||
| <dt>Tags</dt> | ||
| {%- for item in versions.tags %} | ||
| <dd><a href="{{ item.url }}">{{ item.name }}</a></dd> | ||
| {%- endfor %} | ||
| </dl> | ||
| {%- endif %} | ||
| {%- if versions.branches %} | ||
| <dl> | ||
| <dt>Branches</dt> | ||
| {%- for item in versions.branches %} | ||
| <dd><a href="{{ item.url }}">{{ item.name }}</a></dd> | ||
| {%- endfor %} | ||
| </dl> | ||
| {%- endif %} | ||
| </div> | ||
| </div> | ||
| {%- endif %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| from __future__ import annotations | ||
|
|
||
| from datetime import datetime | ||
| from pathlib import Path | ||
| import re | ||
|
|
||
| project = "zppy-interfaces" | ||
| author = "E3SM Project" | ||
| copyright = f"{datetime.now():%Y}, {author}" | ||
|
|
||
| _repo_root = Path(__file__).resolve().parents[2] | ||
| _version_file = _repo_root / "zppy_interfaces" / "version.py" | ||
| _version_match = re.search( | ||
| r'__version__\s*=\s*"([^"]+)"', _version_file.read_text(encoding="utf-8") | ||
| ) | ||
| release = _version_match.group(1) if _version_match else "unknown" | ||
| version = release | ||
|
|
||
| extensions = [] | ||
| templates_path = ["_templates"] | ||
| exclude_patterns = ["_build"] | ||
|
|
||
| html_theme = "sphinx_rtd_theme" | ||
| html_static_path = ["_static"] | ||
| html_css_files = ["style.css"] | ||
| html_title = "zppy-interfaces documentation" | ||
| html_sidebars = { | ||
| "**": [ | ||
| "globaltoc.html", | ||
| "localtoc.html", | ||
| "relations.html", | ||
| "searchbox.html", | ||
| "versions.html", | ||
| ] | ||
| } | ||
|
|
||
| smv_tag_whitelist = r"^v.*$" | ||
| smv_branch_whitelist = r"^(main|master)$" | ||
| smv_remote_whitelist = r"^origin$" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| *********************************** | ||
| Developer Guide: global_time_series | ||
| *********************************** | ||
|
|
||
| This page describes how ``zi-global-time-series`` is implemented. For the | ||
| runtime parameters and output-facing behavior, see :doc:`global_time_series`. | ||
|
|
||
| Entry point and main flow | ||
| ========================= | ||
|
|
||
| The CLI entry point is ``zppy_interfaces.global_time_series.__main__:main``. | ||
| The implementation follows this sequence: | ||
|
|
||
| #. ``__main__._get_args()`` parses the command-line arguments and builds a | ||
| ``zppy_interfaces.global_time_series.utils.Parameters`` instance. | ||
| #. ``Parameters`` normalizes booleans, region aliases, and comma-separated plot | ||
| selections, then validates that the request is internally consistent. | ||
| #. ``main()`` optionally calls ``create_ocean_ts()`` when ocean-dependent | ||
| classic plots are requested with ``use_ocn=True``. | ||
| #. ``main()`` then calls ``run_coupled_global()``. | ||
| #. ``run_coupled_global()`` builds a | ||
| ``zppy_interfaces.global_time_series.coupled_global.utils.RequestedVariables`` | ||
| object, generates the plots, and optionally creates viewer HTML output. | ||
|
|
||
| Key modules | ||
| =========== | ||
|
|
||
| * ``zppy_interfaces/global_time_series/__main__.py`` contains the CLI parser | ||
| and the top-level control flow. | ||
| * ``zppy_interfaces/global_time_series/utils.py`` defines ``Parameters`` and | ||
| the request normalization logic. | ||
| * ``zppy_interfaces/global_time_series/create_ocean_ts.py`` creates ocean | ||
| support time series before plotting when needed. | ||
| * ``zppy_interfaces/global_time_series/coupled_global/driver.py`` coordinates | ||
| original plots, component plots, and viewer generation. | ||
| * ``zppy_interfaces/global_time_series/coupled_global/mode_pdf.py`` assembles | ||
| cumulative PDFs when ``make_viewer=False``. | ||
| * ``zppy_interfaces/global_time_series/coupled_global/mode_viewer.py`` and the | ||
| ``mix_viewer_*`` helpers build the viewer pages when ``make_viewer=True``. | ||
|
|
||
| Developer notes | ||
| =============== | ||
|
|
||
| * The classic plot names in ``plots_original`` are not the same thing as raw | ||
| variable names, so the driver keeps them separate from the component-variable | ||
| lists. | ||
| * Land plots depend on ``zppy_land_fields.csv`` for the accepted variable set, | ||
| grouping metadata, units, and long names. | ||
| * The driver always writes output relative to ``results_dir``, and viewer mode | ||
| adds HTML pages on top of the figure generation rather than replacing the | ||
| underlying plot production. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| ****************** | ||
| Developer Guide | ||
| ****************** | ||
|
|
||
| Use these pages when you want to understand how the repository is organized, | ||
| where each CLI entry point starts, and how the internal processing flow is | ||
| implemented. | ||
|
|
||
| Repository layout | ||
| ================= | ||
|
|
||
| The implementation is organized under ``zppy_interfaces``: | ||
|
|
||
| * ``zppy_interfaces/global_time_series`` contains the global time-series CLI, | ||
| ocean time-series generation helpers, HTML templates, and the | ||
| ``zppy_land_fields.csv`` variable catalogue. | ||
| * ``zppy_interfaces/pcmdi_diags`` contains CLI entry points for observation | ||
| linking, mean-climate diagnostics, variability modes, ENSO, synthetic plots, | ||
| and the shared setup logic used by those commands. | ||
| * ``zppy_interfaces/multi_utils`` contains shared logging and viewer helpers | ||
| used by both interfaces. | ||
|
|
||
| Interface implementation guides | ||
| =============================== | ||
|
|
||
| .. toctree:: | ||
| :maxdepth: 1 | ||
|
|
||
| developer_global_time_series | ||
| developer_pcmdi_diags | ||
|
|
||
| Testing | ||
| ======= | ||
|
|
||
| .. code-block:: bash | ||
|
|
||
| # Set up branch | ||
| cd zppy-interfaces | ||
| git status # Check for uncommitted changes | ||
| git fetch upstream main | ||
| git checkout main | ||
| git reset --hard upstream/main | ||
| git log --oneline | head -n 1 | ||
| # Check that we're up to date with either: | ||
| # 1. The latest commit on main: https://github.com/E3SM-Project/zppy-interfaces/commits/main/ | ||
| # 2. The commits of the pull request being tested. | ||
|
|
||
| # Set up conda environment | ||
| bash # Run bash so we're in an isolated subshell | ||
| # Make sure conda is activated | ||
| rm -rf build | ||
| conda clean --all --y | ||
| conda env create -f conda/dev.yml -n env-name | ||
| conda activate env-name | ||
| pre-commit run --all-files | ||
| python -m pip install . | ||
|
|
||
| # Run unit tests | ||
| pytest tests/unit/global_time_series/test_*.py | ||
| pytest tests/unit/pcmdi_diags/test_*.py | ||
|
|
||
| # Note that integration testing is done as part of zppy's testing. |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.