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,13 +1,18 @@
# regionate

A package for creating xgcm-grid consistent regional masks and boundaries, leveraging its sibling package [`sectionate`](https://github.com/raphaeldussin/sectionate).
A package for creating xgcm-grid consistent regional masks and boundaries, leveraging its sibling package [`sectionate`](https://github.com/MOM6-community/sectionate).

[![PyPI](https://badge.fury.io/py/regionate.svg)](https://badge.fury.io/py/regionate)
[![Conda Version](https://img.shields.io/conda/vn/conda-forge/regionate)](https://anaconda.org/conda-forge/regionate)
[![Docs](https://readthedocs.org/projects/regionate/badge/?version=latest)](https://regionate.readthedocs.io/en/latest/)
[![License](https://img.shields.io/github/license/hdrake/regionate)](https://github.com/hdrake/regionate)

Quick Start Guide
-----------------

**For users: minimal installation within an existing environment**
```bash
pip install regionate
conda install regionate
```

**For developers: installing from scratch using `conda`**
Expand Down
2 changes: 1 addition & 1 deletion conda/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ package:

source:
url: https://pypi.org/packages/source/r/regionate/regionate-{{ version }}.tar.gz
sha256: 42b33b9a9a83fb23b737e39dd2ac40993f939bf84eb25ecb4e0a7eab6e0780be
sha256: 1e7db126ee20b207a027bcd8c2e493cebe312f2b6202de7a1fb4a3d82c81a942

build:
noarch: python
Expand Down
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)
3 changes: 3 additions & 0 deletions docs/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +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 = 'regionate'
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")
]
12 changes: 12 additions & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
regionate: a package for creating xgcm-grid consistent regional masks and boundaries
=============================================================================================

.. toctree::
:maxdepth: 2
:caption: Contents:

installation
examples/1_thickness_budget
examples/2_advective_heat_convergence
examples/3_Arctic_heat_CM4p25
examples/4_bounded_by_named_sections
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
^^^^^^^^^^^^

regionate is compatible with python 3 (>= version 3.11). It requires xgcm
(>= version 0.9.0).

Installation from Conda Forge
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The easiest way to install regionate along with its dependencies is via conda
forge::

conda install -c conda-forge regionate


Installation from Pip
^^^^^^^^^^^^^^^^^^^^^

An alternative is to use pip::

pip install regionate

This will install the latest release from
`pypi <https://pypi.python.org/pypi>`_.

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

regionate is under active development. To obtain the latest development version,
you may clone the `source repository <https://github.com/hdrake/regionate>`_
and install it using pip::

pip install git+https://github.com/hdrake/regionate.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/>`_
regionate and submit issues_ and `pull requests`_.

.. _issues: https://github.com/hdrake/regionate/issues
.. _`pull requests`: https://github.com/hdrake/regionate/pulls
Loading
Loading