From 0dcd3a1bf945d0057beefe6ebabf3757f1550489 Mon Sep 17 00:00:00 2001 From: hfdrake Date: Thu, 19 Feb 2026 20:29:56 -0800 Subject: [PATCH 1/7] Disable default channel --- ci/environment.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/ci/environment.yml b/ci/environment.yml index bf4810b..31d265d 100644 --- a/ci/environment.yml +++ b/ci/environment.yml @@ -1,6 +1,7 @@ name: test_env_sectionate channels: - conda-forge + - nodefaults dependencies: - python>=3.12 - pytest From c51954af22b955438ee7fa6f8f8f9b047c0bf4f9 Mon Sep 17 00:00:00 2001 From: Henri Drake Date: Fri, 20 Feb 2026 20:35:35 -0800 Subject: [PATCH 2/7] Add conda recipe and update README accordingly --- README.md | 7 +++++-- conda/meta.yaml | 49 ++++++++++++++++++++++++++++++++++++++++++++ docs/environment.yml | 4 ++++ 3 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 conda/meta.yaml diff --git a/README.md b/README.md index 4f2d96b..edcfb17 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,17 @@ # sectionate A package to sample grid-consistent sections from ocean model outputs -[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/raphaeldussin/sectionate/master) +[![PyPI](https://badge.fury.io/py/sectionate.svg)](https://badge.fury.io/py/sectionate) +[![Conda Version](https://img.shields.io/conda/vn/conda-forge/sectionate)](https://anaconda.org/conda-forge/sectionate) +[![Docs](https://readthedocs.org/projects/sectionate/badge/?version=latest)](https://sectionate.readthedocs.io/en/latest/) +[![License](https://img.shields.io/github/license/MOM6-Community/sectionate)](https://github.com/MOM6-Community/sectionate) Quick Start Guide ----------------- **For users: minimal installation within an existing environment** ```bash -pip install sectionate +conda install sectionate ``` **For developers: installing dependencies from scratch using `conda`** diff --git a/conda/meta.yaml b/conda/meta.yaml new file mode 100644 index 0000000..4ecac10 --- /dev/null +++ b/conda/meta.yaml @@ -0,0 +1,49 @@ +{% set name = "sectionate" %} +{% set version = "0.3.3" %} +{% set python_min = "3.11" %} + +package: + name: {{ name|lower }} + version: {{ version }} + +source: + url: https://pypi.org/packages/source/s/sectionate/sectionate-{{ version }}.tar.gz + sha256: b855b091e0c5ac56ab09ec96822ad46ee2ec89bf3b6b3aecb53cbe16dbc36ecb + +build: + noarch: python + number: 0 + script: {{ PYTHON }} -m pip install . -vv --no-deps --no-build-isolation + +requirements: + host: + - python {{ python_min }} + - pip + - hatchling + run: + - python >={{ python_min }} + - dask + - numba + - numpy + - scipy + - xarray + - xgcm >=0.9.0 + +test: + requires: + - python {{ python_min }} + - pip + imports: + - sectionate + commands: + - pip check + +about: + home: https://github.com/MOM6-Community/sectionate + summary: A package to sample grid-consistent sections from ocean model outputs + license: GPL-3.0-only + license_file: LICENSE + +extra: + recipe-maintainers: + - hdrake diff --git a/docs/environment.yml b/docs/environment.yml index 778dd27..52bbea6 100644 --- a/docs/environment.yml +++ b/docs/environment.yml @@ -11,3 +11,7 @@ dependencies: - netcdf4 - pydap - pytest + - sphinx + - nbsphinx + - ipykernel + - pip From 76841b9c6b50e7b807a28f3ac526b48e031fcb4b Mon Sep 17 00:00:00 2001 From: Henri Drake Date: Fri, 20 Feb 2026 20:40:30 -0800 Subject: [PATCH 3/7] Template docs, adapted from xbudget --- docs/Makefile | 20 +++++++++ docs/make.bat | 35 +++++++++++++++ docs/source/_static/.gitkeep | 0 docs/source/_static/custom.css | 39 +++++++++++++++++ docs/source/_templates/.gitkeep | 0 docs/source/conf.py | 78 +++++++++++++++++++++++++++++++++ docs/source/index.rst | 13 ++++++ docs/source/installation.rst | 44 +++++++++++++++++++ 8 files changed, 229 insertions(+) create mode 100644 docs/Makefile create mode 100644 docs/make.bat create mode 100644 docs/source/_static/.gitkeep create mode 100644 docs/source/_static/custom.css create mode 100644 docs/source/_templates/.gitkeep create mode 100644 docs/source/conf.py create mode 100644 docs/source/index.rst create mode 100644 docs/source/installation.rst diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 0000000..d0c3cbf --- /dev/null +++ b/docs/Makefile @@ -0,0 +1,20 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line, and also +# from the environment for the first two. +SPHINXOPTS ?= +SPHINXBUILD ?= sphinx-build +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) diff --git a/docs/make.bat b/docs/make.bat new file mode 100644 index 0000000..747ffb7 --- /dev/null +++ b/docs/make.bat @@ -0,0 +1,35 @@ +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=source +set BUILDDIR=build + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.https://www.sphinx-doc.org/ + exit /b 1 +) + +if "%1" == "" goto help + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% + +:end +popd diff --git a/docs/source/_static/.gitkeep b/docs/source/_static/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/docs/source/_static/custom.css b/docs/source/_static/custom.css new file mode 100644 index 0000000..38c532d --- /dev/null +++ b/docs/source/_static/custom.css @@ -0,0 +1,39 @@ +/* Responsive layout widening for Alabaster + - On small screens: use full width (with padding) + - On typical laptops: ~1100–1250px content area + - On big screens: cap so lines don't get absurdly long +*/ + +div.document { + /* Total doc block width (sidebar + content) */ + width: min(96vw, 1400px); + margin: 0 auto; +} + +/* Keep the main content comfortable: cap line length */ +div.body { + /* body width within the document area */ + max-width: 900px; +} + +/* Give the sidebar a stable width; let it wrap below on small screens */ +div.sphinxsidebar { + width: 270px; +} + +/* On narrower screens, don't force sidebar + body side-by-side */ +@media (max-width: 900px) { + div.document { + width: 96vw; + } + div.sphinxsidebar { + float: none; + width: auto; + } + div.bodywrapper { + margin: 0; + } + div.body { + max-width: none; + } +} \ No newline at end of file diff --git a/docs/source/_templates/.gitkeep b/docs/source/_templates/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/docs/source/conf.py b/docs/source/conf.py new file mode 100644 index 0000000..38a8a50 --- /dev/null +++ b/docs/source/conf.py @@ -0,0 +1,78 @@ +# Configuration file for the Sphinx documentation builder. +# +# For the full list of built-in configuration values, see the documentation: +# https://www.sphinx-doc.org/en/master/usage/configuration.html + +from importlib.metadata import version as get_version +from pathlib import Path +import shutil + +# The master toctree document. +master_doc = "index" + +# -- Project information ----------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information + + +project = 'xbudget' +copyright = '2026, Henri Drake' +author = 'Henri Drake' + +release = get_version(project) +version = ".".join(release.split(".")[:2]) + +# -- General configuration --------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration + +extensions = [ + "nbsphinx" +] + +templates_path = ['_templates'] +exclude_patterns = [] + +# Don't execute notebooks on RTD unless you want that +nbsphinx_execute = "never" + +# -- Copy notebooks from repo root/examples into docs/source/examples -------- + +HERE = Path(__file__).resolve() +DOCS_SOURCE = HERE.parent # docs/source +REPO_ROOT = HERE.parents[2] # up two levels from conf.py +EXAMPLES_SRC = REPO_ROOT / "examples" +EXAMPLES_DST = DOCS_SOURCE / "examples" + +def _sync_examples(): + if not EXAMPLES_SRC.exists(): + return + + # fresh copy so removed notebooks don't linger + if EXAMPLES_DST.exists(): + shutil.rmtree(EXAMPLES_DST) + EXAMPLES_DST.mkdir(parents=True, exist_ok=True) + + for nb in EXAMPLES_SRC.rglob("*.ipynb"): + rel = nb.relative_to(EXAMPLES_SRC) + out = EXAMPLES_DST / rel + out.parent.mkdir(parents=True, exist_ok=True) + shutil.copy2(nb, out) + +_sync_examples() + +# -- Options for HTML output ------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output + +html_title = f"{project} v{version} documentation" + +html_theme = "alabaster" + +html_theme_options = { + "sidebar_width": "270px", +} + +html_static_path = ["_static"] +html_css_files = ["custom.css"] + +latex_documents = [ + ("index") +] \ No newline at end of file diff --git a/docs/source/index.rst b/docs/source/index.rst new file mode 100644 index 0000000..002626b --- /dev/null +++ b/docs/source/index.rst @@ -0,0 +1,13 @@ +sectionate: a package to sample grid-consistent sections from structured ocean model outputs +============================================================================================= + +.. toctree:: + :maxdepth: 2 + :caption: Contents: + + installation + examples/1_creating_an_OSNAP_section + examples/2_OSNAP_transports_CM4p25 + examples/3_Labrador_convergence_CM4p25 + examples/4_sections_on_global_tripolar_grid + examples/5_MOC_transports_CM4p25 diff --git a/docs/source/installation.rst b/docs/source/installation.rst new file mode 100644 index 0000000..8f73e08 --- /dev/null +++ b/docs/source/installation.rst @@ -0,0 +1,44 @@ +Installation +------------ + +Requirements +^^^^^^^^^^^^ + +sectionate is compatible with python 3 (>= version 3.11). It requires xgcm +(>= version 0.9.0). + +Installation from Conda Forge +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The easiest way to install sectionate along with its dependencies is via conda +forge:: + + conda install -c conda-forge sectionate + + +Installation from Pip +^^^^^^^^^^^^^^^^^^^^^ + +An alternative is to use pip:: + + pip install sectionate + +This will install the latest release from +`pypi `_. + +Installation from GitHub +^^^^^^^^^^^^^^^^^^^^^^^^ + +sectionate is under active development. To obtain the latest development version, +you may clone the `source repository `_ +and install it using pip:: + + pip install git+https://github.com/MOM6-Community/sectionate.git + +More comprehensive instructions for installing a development environment can be found in the Contributor Guide (coming soon). + +Users are encouraged to `fork `_ +sectionate and submit issues_ and `pull requests`_. + +.. _issues: https://github.com/MOM6-Community/sectionate/issues +.. _`pull requests`: https://github.com/MOM6-Community/sectionate/pulls \ No newline at end of file From 5523a82f807c4801adfc04d5728f50b5b44cb35d Mon Sep 17 00:00:00 2001 From: Henri Drake Date: Fri, 20 Feb 2026 20:46:51 -0800 Subject: [PATCH 4/7] Update conf.py for sectionate --- docs/source/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 38a8a50..f0bdab3 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -14,7 +14,7 @@ # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information -project = 'xbudget' +project = 'sectionate' copyright = '2026, Henri Drake' author = 'Henri Drake' From 9a41c7e33bed250b68170dbd4d3fd0b768c7830d Mon Sep 17 00:00:00 2001 From: Henri Drake Date: Fri, 20 Feb 2026 20:48:38 -0800 Subject: [PATCH 5/7] Added .readthedocs.yaml --- .readthedocs.yaml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .readthedocs.yaml diff --git a/.readthedocs.yaml b/.readthedocs.yaml new file mode 100644 index 0000000..6451026 --- /dev/null +++ b/.readthedocs.yaml @@ -0,0 +1,28 @@ +# Read the Docs configuration file +# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details + +# Required +version: 2 + +# Set the OS, Python version, and other tools you might need +build: + os: ubuntu-24.04 + tools: + python: "miniforge3-latest" + +# Build documentation in the "docs/" directory with Sphinx +sphinx: + builder: html + configuration: docs/source/conf.py + fail_on_warning: true + +# Don't build any extra output files +formats: [] + +python: + install: + - method: pip + path: . + +conda: + environment: docs/environment.yml \ No newline at end of file From 6eb5156fee796ece6cd91d3ae86d7eede9ef391a Mon Sep 17 00:00:00 2001 From: Henri Drake Date: Fri, 20 Feb 2026 20:57:20 -0800 Subject: [PATCH 6/7] Added note about only supporting structured grids --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index edcfb17..f99b019 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ # sectionate A package to sample grid-consistent sections from ocean model outputs +(Currently only supports structured grids.) + [![PyPI](https://badge.fury.io/py/sectionate.svg)](https://badge.fury.io/py/sectionate) [![Conda Version](https://img.shields.io/conda/vn/conda-forge/sectionate)](https://anaconda.org/conda-forge/sectionate) [![Docs](https://readthedocs.org/projects/sectionate/badge/?version=latest)](https://sectionate.readthedocs.io/en/latest/) From 42fd778b4f707c5a3dd464e0f0d1905b6dbf3116 Mon Sep 17 00:00:00 2001 From: Henri Drake Date: Fri, 20 Feb 2026 21:22:17 -0800 Subject: [PATCH 7/7] Lowercase community --- conda/meta.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conda/meta.yaml b/conda/meta.yaml index 4ecac10..37cdadf 100644 --- a/conda/meta.yaml +++ b/conda/meta.yaml @@ -39,7 +39,7 @@ test: - pip check about: - home: https://github.com/MOM6-Community/sectionate + home: https://github.com/MOM6-community/sectionate summary: A package to sample grid-consistent sections from ocean model outputs license: GPL-3.0-only license_file: LICENSE