Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -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
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
# 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)
(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/)
[![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`**
Expand Down
1 change: 1 addition & 0 deletions ci/environment.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: test_env_sectionate
channels:
- conda-forge
- nodefaults
dependencies:
- python>=3.12
- pytest
49 changes: 49 additions & 0 deletions conda/meta.yaml
Original file line number Diff line number Diff line change
@@ -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
20 changes: 20 additions & 0 deletions docs/Makefile
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, 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)
4 changes: 4 additions & 0 deletions docs/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,7 @@ dependencies:
- netcdf4
- pydap
- pytest
- sphinx
- nbsphinx
- ipykernel
- pip
35 changes: 35 additions & 0 deletions docs/make.bat
Original file line number Diff line number Diff line change
@@ -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
Empty file added docs/source/_static/.gitkeep
Empty file.
39 changes: 39 additions & 0 deletions docs/source/_static/custom.css
Original file line number Diff line number Diff line change
@@ -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;
}
}
Empty file added docs/source/_templates/.gitkeep
Empty file.
78 changes: 78 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -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 = 'sectionate'
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")
]
13 changes: 13 additions & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
@@ -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
44 changes: 44 additions & 0 deletions docs/source/installation.rst
Original file line number Diff line number Diff line change
@@ -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 <https://pypi.python.org/pypi>`_.

Installation from GitHub
^^^^^^^^^^^^^^^^^^^^^^^^

sectionate is under active development. To obtain the latest development version,
you may clone the `source repository <https://github.com/MOM6-Community/sectionate>`_
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 <https://help.github.com/articles/fork-a-repo/>`_
sectionate and submit issues_ and `pull requests`_.

.. _issues: https://github.com/MOM6-Community/sectionate/issues
.. _`pull requests`: https://github.com/MOM6-Community/sectionate/pulls
Loading