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 diff --git a/README.md b/README.md index ff8cd0a..036a28b 100644 --- a/README.md +++ b/README.md @@ -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`** diff --git a/conda/meta.yaml b/conda/meta.yaml index cb953ad..a244d23 100644 --- a/conda/meta.yaml +++ b/conda/meta.yaml @@ -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 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/environment.yml b/docs/environment.yml index cf4931a..d90a1df 100644 --- a/docs/environment.yml +++ b/docs/environment.yml @@ -11,4 +11,7 @@ dependencies: - netcdf4 - pydap - pytest + - sphinx + - nbsphinx + - ipykernel - pip 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..ab9c0bd --- /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 = '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") +] \ No newline at end of file diff --git a/docs/source/index.rst b/docs/source/index.rst new file mode 100644 index 0000000..239002f --- /dev/null +++ b/docs/source/index.rst @@ -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 \ No newline at end of file diff --git a/docs/source/installation.rst b/docs/source/installation.rst new file mode 100644 index 0000000..9f070d2 --- /dev/null +++ b/docs/source/installation.rst @@ -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 `_. + +Installation from GitHub +^^^^^^^^^^^^^^^^^^^^^^^^ + +regionate 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/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 `_ +regionate and submit issues_ and `pull requests`_. + +.. _issues: https://github.com/hdrake/regionate/issues +.. _`pull requests`: https://github.com/hdrake/regionate/pulls \ No newline at end of file diff --git a/examples/1_thickness_budget.ipynb b/examples/1_thickness_budget.ipynb index 3d75471..43ed574 100644 --- a/examples/1_thickness_budget.ipynb +++ b/examples/1_thickness_budget.ipynb @@ -1,27 +1,26 @@ { "cells": [ { - "cell_type": "code", - "execution_count": 1, - "id": "724b9f6d-5d12-407d-a7c4-530b6dffc1cf", + "cell_type": "markdown", + "id": "f64080dc", "metadata": {}, - "outputs": [], "source": [ - "%load_ext autoreload\n", - "%autoreload 2" + "# Horizontal convergence of thickness fluxes\n", + "\n", + "Using `regionmask` and `sectionate` to evaluate the convergence of vertically-integrated mass fluxes" ] }, { "cell_type": "markdown", - "id": "9c1f2776-8a77-4907-9951-55c298a9e905", + "id": "4bff7b1c", "metadata": {}, "source": [ - "### Using `regionmask` and `sectionate` to evaluate the convergence of vertically-integrated mass fluxes" + "First, we import packages." ] }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 1, "id": "66ee888d-040e-4ab9-b8fa-be025cb8c651", "metadata": {}, "outputs": [], @@ -46,12 +45,12 @@ "id": "a95a1404-5fb6-4ef9-af88-f3514dbf2f55", "metadata": {}, "source": [ - "### Load data" + "Next, we load the datasets and set up a `xgcm.Grid` instance." ] }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 2, "id": "20b3d162-bd70-47f0-ab7d-4182e40cc2e2", "metadata": {}, "outputs": [ @@ -59,8 +58,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "File 'MOM6_global_example_vertically_integrated_mass_budget_v0_0_6.nc' being downloaded to ../data/MOM6_global_example_vertically_integrated_mass_budget_v0_0_6.nc.\n", - "File 'MOM6_global_example_vertically_integrated_mass_budget_v0_0_6.nc' has completed download to ../data/MOM6_global_example_vertically_integrated_mass_budget_v0_0_6.nc.\n" + "File 'MOM6_global_example_vertically_integrated_mass_budget_v0_0_6.nc' already exists at ../data/MOM6_global_example_vertically_integrated_mass_budget_v0_0_6.nc. Skipping download.\n" ] } ], @@ -73,17 +71,25 @@ "rho0 = 1035. # kg/m^3" ] }, + { + "cell_type": "markdown", + "id": "40aec5b1", + "metadata": {}, + "source": [ + "## Analysis of vertically-integrated thickness budget" + ] + }, { "cell_type": "markdown", "id": "9dd6938d-1214-4689-a6d9-d68625e5ecee", "metadata": {}, "source": [ - "#### Plot vertically-integrated thickness budget" + "### Plot vertically-integrated thickness budget" ] }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 3, "id": "cc692041-c2d0-4122-8062-96fdcd8a5cd9", "metadata": {}, "outputs": [ @@ -115,14 +121,14 @@ "id": "70b1836b-5603-4dfd-bacc-88036b59761a", "metadata": {}, "source": [ - "#### Define an arbitrary close sub-region of the domain defined by an irregular polygon\n", + "### Define a region of interest\n", "\n", - "We zoom in on the Greater Baltic Sea region analyzed in [Drake et al. 2025](https://doi.org/10.1029/2024MS004383)." + "We define an arbitrary close sub-region of the domain defined by an irregular polygon, zooming in on the Greater Baltic Sea region analyzed in [Drake et al. 2025](https://doi.org/10.1029/2024MS004383)." ] }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 4, "id": "7b772611-c67b-4494-8b06-a5391ca89d75", "metadata": { "tags": [] @@ -137,7 +143,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 5, "id": "54289093-5fcc-4e12-8958-ced7fd8ba808", "metadata": {}, "outputs": [ @@ -178,7 +184,7 @@ "id": "d71c1859-9835-46ba-bb1d-1522db3b1c5a", "metadata": {}, "source": [ - "#### Verifying the 2D Divergence theorem for area integrals over complicated sub-domains\n", + "### Verifying the 2D (vertically-integrated) Divergence Theorem\n", "\n", "The specific thickness equation in Boussinesq configurations of MOM6 is given by\n", "\\begin{equation}\n", @@ -201,7 +207,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 6, "id": "3cb55d26-938b-4de7-851e-77b3209d7f04", "metadata": {}, "outputs": [ @@ -233,7 +239,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 7, "id": "660fc904-a24f-416e-8b06-47fd1638f342", "metadata": {}, "outputs": [ @@ -288,7 +294,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.13.5" + "version": "3.13.9" } }, "nbformat": 4, diff --git a/examples/2_advective_heat_convergence.ipynb b/examples/2_advective_heat_convergence.ipynb index 7b5fe4b..0d37774 100644 --- a/examples/2_advective_heat_convergence.ipynb +++ b/examples/2_advective_heat_convergence.ipynb @@ -1,27 +1,16 @@ { "cells": [ - { - "cell_type": "code", - "execution_count": 1, - "id": "724b9f6d-5d12-407d-a7c4-530b6dffc1cf", - "metadata": {}, - "outputs": [], - "source": [ - "%load_ext autoreload\n", - "%autoreload 2" - ] - }, { "cell_type": "markdown", - "id": "9c1f2776-8a77-4907-9951-55c298a9e905", + "id": "e0c4f4b9", "metadata": {}, "source": [ - "# Applying the divergence theorem to heat budgets with `sectionate` and `regionmask`" + "# Horizontal convergence of vertically-integrated heat fluxes" ] }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 1, "id": "66ee888d-040e-4ab9-b8fa-be025cb8c651", "metadata": {}, "outputs": [], @@ -55,7 +44,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 2, "id": "20b3d162-bd70-47f0-ab7d-4182e40cc2e2", "metadata": {}, "outputs": [ @@ -63,8 +52,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "File 'MOM6_global_example_vertically_integrated_heat_budget_v0_0_6.nc' being downloaded to ../data/MOM6_global_example_vertically_integrated_heat_budget_v0_0_6.nc.\n", - "File 'MOM6_global_example_vertically_integrated_heat_budget_v0_0_6.nc' has completed download to ../data/MOM6_global_example_vertically_integrated_heat_budget_v0_0_6.nc.\n" + "File 'MOM6_global_example_vertically_integrated_heat_budget_v0_0_6.nc' already exists at ../data/MOM6_global_example_vertically_integrated_heat_budget_v0_0_6.nc. Skipping download.\n" ] } ], @@ -91,12 +79,12 @@ "id": "463a6a1d-1a1e-40b7-9b35-35a8039cc4a7", "metadata": {}, "source": [ - "#### Plot the vertically integrated heat budget" + "### Plot the vertically integrated heat budget" ] }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 3, "id": "cc692041-c2d0-4122-8062-96fdcd8a5cd9", "metadata": {}, "outputs": [ @@ -147,7 +135,7 @@ "id": "d71c1859-9835-46ba-bb1d-1522db3b1c5a", "metadata": {}, "source": [ - "#### Verifying the divergence theorem for area integrals over complicated sub-domains\n", + "### Verifying the divergence theorem for area integrals over complicated sub-domains\n", "\n", "The extensive heat (or, equivalently, potential temperature) equation in MOM6 is given by\n", "\\begin{equation}\n", @@ -180,7 +168,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 4, "id": "bfc4cf0d-de36-419a-82e7-bf9c3412adb6", "metadata": {}, "outputs": [], @@ -197,7 +185,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 5, "id": "ea10d4ee-de08-4760-8ad8-21cec45edea1", "metadata": {}, "outputs": [ @@ -295,7 +283,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 6, "id": "7b772611-c67b-4494-8b06-a5391ca89d75", "metadata": { "tags": [] @@ -309,7 +297,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 7, "id": "f0cedbc4-0b28-419c-a459-1dd313297478", "metadata": {}, "outputs": [ @@ -405,7 +393,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 8, "id": "f76e3b1b-663c-4173-a730-c6e225429540", "metadata": {}, "outputs": [], @@ -418,7 +406,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 9, "id": "54289093-5fcc-4e12-8958-ced7fd8ba808", "metadata": {}, "outputs": [ @@ -462,7 +450,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 10, "id": "3cb55d26-938b-4de7-851e-77b3209d7f04", "metadata": {}, "outputs": [ @@ -512,7 +500,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 11, "id": "e8946f7e-963c-4220-8048-fbd0252578d6", "metadata": {}, "outputs": [ @@ -567,7 +555,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 12, "id": "f12cf1e8-5481-48b0-9751-2e472bd59f0f", "metadata": {}, "outputs": [], @@ -577,7 +565,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 13, "id": "966664a3-38e2-4bb8-a63f-4970d2ac21a3", "metadata": {}, "outputs": [ @@ -631,7 +619,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 14, "id": "f58fa03b-9a0d-4171-b779-61b740b31d95", "metadata": {}, "outputs": [ @@ -668,7 +656,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 15, "id": "e5324071-95c0-4333-9566-c2f40a47769b", "metadata": {}, "outputs": [], @@ -680,7 +668,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 16, "id": "72e2a0b3-6d5a-4457-971e-5b89f80d91c8", "metadata": {}, "outputs": [ @@ -699,7 +687,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 17, "id": "801341e2-0e6b-45f5-ad2c-6d70b055c75e", "metadata": {}, "outputs": [ @@ -752,7 +740,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 18, "id": "e2080d20-5722-4ef3-871d-054bde634d4d", "metadata": {}, "outputs": [ @@ -813,7 +801,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.13.5" + "version": "3.13.9" } }, "nbformat": 4, diff --git a/examples/3_Arctic_heat_CM4p25.ipynb b/examples/3_Arctic_heat_CM4p25.ipynb index 13bc03e..c184248 100644 --- a/examples/3_Arctic_heat_CM4p25.ipynb +++ b/examples/3_Arctic_heat_CM4p25.ipynb @@ -1,23 +1,23 @@ { "cells": [ { - "cell_type": "code", - "execution_count": 1, - "id": "80b35dd2-b461-475c-8230-f17bdf84cb02", + "cell_type": "markdown", + "id": "c82f9fe0", "metadata": {}, - "outputs": [], "source": [ - "%load_ext autoreload\n", - "%autoreload 2" + "# Corner case: bipolar grid fold\n", + "\n", + "Examples of challenging test case are regions that cross periodic boundaries or OM4's Arctic bipolar fold." ] }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 1, "id": "ce10e9c7-9cf0-42a8-99b9-7c7dbc6d6315", "metadata": {}, "outputs": [], "source": [ + "# Import packages\n", "import numpy as np\n", "import xgcm\n", "import xarray as xr\n", @@ -26,14 +26,6 @@ "import matplotlib.pyplot as plt" ] }, - { - "cell_type": "markdown", - "id": "a4f8e265", - "metadata": {}, - "source": [ - "# A difficult test case: regions that cross periodic boundaries and OM4's Arctic bipolar fold" - ] - }, { "cell_type": "markdown", "id": "cdf93c7f-3d03-4957-a402-fd2b9eabf65a", @@ -44,7 +36,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 2, "id": "6e89e613-2319-4f23-abf1-0111d62f8bd9", "metadata": {}, "outputs": [ @@ -72,7 +64,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 3, "id": "47aff34f-4180-4c32-ad5d-e8617352763c", "metadata": {}, "outputs": [ @@ -127,7 +119,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 4, "id": "4421a5c4-0bc8-4ac8-ad9d-5016e63ca237", "metadata": {}, "outputs": [ @@ -215,7 +207,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 5, "id": "d5d003c7-4c12-474f-ba11-5f4400fc724e", "metadata": {}, "outputs": [], @@ -236,7 +228,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 6, "id": "12e1f246-0767-4909-80b2-2d4cc205463a", "metadata": {}, "outputs": [ @@ -317,7 +309,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 7, "id": "96e26bab-2082-4f5c-8c9c-423261e85595", "metadata": {}, "outputs": [], @@ -344,7 +336,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 8, "id": "922d7502-becb-4e8f-a55d-64ca1e11dc72", "metadata": {}, "outputs": [ @@ -370,7 +362,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 9, "id": "d131fc56-1eb4-48b3-831b-3ceaa5c2194b", "metadata": {}, "outputs": [], @@ -383,7 +375,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 10, "id": "20be3031-f32e-41ad-b630-eff5c4d5ddb2", "metadata": {}, "outputs": [ @@ -422,7 +414,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 11, "id": "9cbdeb5f-e1a9-45a6-be13-93692fa74f39", "metadata": {}, "outputs": [ @@ -496,7 +488,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.13.5" + "version": "3.13.9" } }, "nbformat": 4, diff --git a/examples/4_bounded_by_named_sections.ipynb b/examples/4_bounded_by_named_sections.ipynb index a7df435..80e51a3 100644 --- a/examples/4_bounded_by_named_sections.ipynb +++ b/examples/4_bounded_by_named_sections.ipynb @@ -1,16 +1,5 @@ { "cells": [ - { - "cell_type": "code", - "execution_count": 1, - "id": "279dbe8a", - "metadata": {}, - "outputs": [], - "source": [ - "%load_ext autoreload\n", - "%autoreload 2" - ] - }, { "cell_type": "markdown", "id": "f5e96bcb", @@ -21,7 +10,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 1, "id": "ef7f7057", "metadata": {}, "outputs": [], @@ -35,12 +24,12 @@ "id": "df4dcbf2", "metadata": {}, "source": [ - "### 1. Load data" + "## 1. Load data" ] }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 2, "id": "5264b147", "metadata": {}, "outputs": [ @@ -67,14 +56,14 @@ "id": "6b6cc26f", "metadata": {}, "source": [ - "### 2. Define the `BoundedRegion`\n", + "## 2. Define the `BoundedRegion`\n", "\n", "We consider the rectangular Niño 3.4 region (170º-120ºW and 5ºS-5ºS), which is bounded by four straight segments." ] }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 3, "id": "6e913897", "metadata": {}, "outputs": [], @@ -100,7 +89,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 4, "id": "2c29dbff", "metadata": {}, "outputs": [ @@ -133,7 +122,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 5, "id": "5be11ad1", "metadata": {}, "outputs": [], @@ -143,7 +132,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 6, "id": "14e52a6c", "metadata": {}, "outputs": [ @@ -174,25 +163,17 @@ "plt.xlim(-250, -50);" ] }, - { - "cell_type": "markdown", - "id": "0f7c7bad", - "metadata": {}, - "source": [ - "###" - ] - }, { "cell_type": "markdown", "id": "839f399e", "metadata": {}, "source": [ - "### 3. Use the `BoundedRegion`'s mask to compute the net heat flux convergence" + "## 3. Use the `BoundedRegion`'s mask to compute the net heat flux convergence" ] }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 7, "id": "fd922e5a", "metadata": {}, "outputs": [], @@ -207,12 +188,12 @@ "id": "25d69c13", "metadata": {}, "source": [ - "### 4. Use the grid indices of the `BoundedRegion`'s boundary to compute convergent heat fluxes along the boundary" + "## 4. Use the grid indices of the `BoundedRegion`'s boundary to compute convergent heat fluxes along the boundary" ] }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 8, "id": "b79db7d9", "metadata": {}, "outputs": [], @@ -240,7 +221,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 9, "id": "338ccaa8", "metadata": {}, "outputs": [ @@ -250,7 +231,7 @@ "Text(0, 0.5, 'convergent heat transport per grid face [W]')" ] }, - "execution_count": 10, + "execution_count": 9, "metadata": {}, "output_type": "execute_result" }, @@ -293,7 +274,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 10, "id": "e242616e", "metadata": {}, "outputs": [ @@ -320,12 +301,12 @@ "id": "e909a98b", "metadata": {}, "source": [ - "### 5. Testing that our methods satisfy the divergence theorem on the model grid" + "## 5. Testing that our methods satisfy the divergence theorem on the model grid" ] }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 11, "id": "f1af61d6", "metadata": {}, "outputs": [ @@ -352,7 +333,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 12, "id": "633852d2", "metadata": {}, "outputs": [ @@ -360,7 +341,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "/var/folders/bx/qc2zqzmj6fn43b6pscs_6hsc0000gn/T/ipykernel_63962/623782134.py:59: UserWarning: This figure includes Axes that are not compatible with tight_layout, so results might be incorrect.\n", + "/var/folders/bx/qc2zqzmj6fn43b6pscs_6hsc0000gn/T/ipykernel_64878/623782134.py:59: UserWarning: This figure includes Axes that are not compatible with tight_layout, so results might be incorrect.\n", " plt.tight_layout()\n" ] }, @@ -455,7 +436,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.13.5" + "version": "3.13.9" } }, "nbformat": 4,