Skip to content
Closed
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
68 changes: 68 additions & 0 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# (C) Crown Copyright 2025, Met Office.
# The LICENSE file contains full licensing details.
name: Build and deploy the documentation

on:
# Runs on pushes targeting the default branch.
push:
branches: ["profsea-climate"]

# Allows you to run this workflow manually from the Actions tab.
workflow_dispatch:

# Use a login shell so the Conda environment is activated.
defaults:
run:
shell: bash -leo pipefail {0}

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages.
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment,
# skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs
# as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
# Build job
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6

- name: Setup GitHub Pages
uses: actions/configure-pages@v6

- uses: mamba-org/setup-micromamba@v3
with:
environment-file: environment.yml
environment-name: profsea-climate-docs
cache-environment: true
cache-environment-key: env-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('environment.yml') }}

- name: Build with Sphinx
run: make --directory=docs html

- name: Upload artifact
uses: actions/upload-pages-artifact@v4
with:
path: docs/build/html

# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v5
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
*__pycache__*
profsea.egg-info
data/
# Ignore the documentation build directory
docs/build
*.DS_Store
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)
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
25 changes: 25 additions & 0 deletions docs/source/api_reference.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
API Reference
=============

This page exposes selected Python API docs generated from in-code docstrings.

Spatial Projections Module
--------------------------

.. automodule:: profsea.spatial_projections
:no-members:

calc_future_sea_level
~~~~~~~~~~~~~~~~~~~~~

.. autofunction:: profsea.spatial_projections.calc_future_sea_level

calculate_global_components
~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. autofunction:: profsea.spatial_projections.calculate_global_components

calculate_sl_components
~~~~~~~~~~~~~~~~~~~~~~~

.. autofunction:: profsea.spatial_projections.calculate_sl_components
72 changes: 72 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# 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

import os
import sys

sys.path.insert(0, os.path.abspath("../.."))

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

project = 'profsea-climate'
copyright = '2026, MetOffice'
author = 'isabellaascione'
release = '1.0.0'

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.napoleon",
]

napoleon_google_docstring = False
napoleon_numpy_docstring = True
napoleon_include_init_with_doc = True
napoleon_include_private_with_doc = False
napoleon_include_special_with_doc = True
napoleon_use_admonition_for_examples = False
napoleon_use_admonition_for_notes = False
napoleon_use_admonition_for_references = False
napoleon_use_ivar = False
napoleon_use_param = True
napoleon_use_rtype = True

autodoc_mock_imports = [
"dask",
"matplotlib",
"netCDF4",
"numpy",
"pandas",
"profsea.config",
"profsea.directories",
"profsea.emulator",
"profsea.plotting_libraries",
"profsea.slr_pkg",
"profsea.utils",
"rich",
"scipy",
"xarray",
]

templates_path = ['_templates']
exclude_patterns = []



# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = 'pydata_sphinx_theme'
html_theme_options = {
'show_nav_level': 2,
'secondary_sidebar_items': [],
}
html_sidebars = {
"**": ["search-field", "sidebar-nav-bs", "page-toc"],
}
html_static_path = ['_static']
63 changes: 63 additions & 0 deletions docs/source/development_guidelines.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
.. _development_guidelines:

Development Guidelines
======================

This is the Development Guidelines page.

.. _open-an-issue:

Open an Issue
-------------
Before forking the repository, open an issue in the main repository to describe the changes you plan to make. This helps maintainers track contributions and provide feedback early.

.. _fork-the-repository:

Fork the Repository
-------------------
First, create a fork of the repository in your GitHub account:

1. Go to the repository page on GitHub.
2. Click the **Fork** button in the top-right corner.
3. Select your GitHub account as the destination for the fork.

.. _clone-your-fork:

Clone Your Fork
---------------
Clone your forked repository and switch to the `profsea-climate` branch:

.. code-block:: bash

git clone git@github.com:<your-username>/ProFSea-tool.git
cd ProFSea-tool
git checkout profsea-climate

Replace ``<your-username>`` with your GitHub username.

.. _commit-changes-to-your-fork:

Commit Changes to Your Fork
---------------------------
Once you are satisfied with your changes, commit and push them to your fork:

.. code-block:: bash

git add .
git commit -m "Adding feature: <brief description of changes>"
git push origin profsea-climate

Replace ``<brief description of changes>`` with a short summary of your updates.

.. _create-a-pull-request:

Create a Pull Request
---------------------
To contribute your changes to the main repository:

1. Go to your forked repository on GitHub.
2. Click the **Pull Request** button.
3. Select the ``profsea-climate`` branch of the main repository as the base branch.
4. Select the ``profsea-climate`` branch of your fork as the compare branch.
5. Add a title and description for your pull request.
6. Click **Create Pull Request**.
82 changes: 82 additions & 0 deletions docs/source/documentation.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
How to update the documentation
========================================

This is the page describing how to update the documentation.

If you want to update the documentation, follow these steps to ensure that your changes are tested locally before contributing:

1. Initial Steps
-----------------------------------
First of all you need to open an issue, fork and clone the repository. For detailed instructions, refer to the following sections in the :ref:`Development Guidelines <development_guidelines>` page:

- :ref:`Open an Issue <open-an-issue>`
- :ref:`Fork the Repository <fork-the-repository>`
- :ref:`Clone Your Fork <clone-your-fork>`

2. Set Up the Environment
-------------------------
Ensure you have the required dependencies installed to build the documentation.

2.1 Create a Conda Environment
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If you are using Conda, create the environment from the ``environment.yml`` file:

.. code-block:: bash

conda env create -f environment.yml
conda activate profsea-climate-docs

2.2 Install Dependencies with Pip (Optional)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If you are not using Conda, install the dependencies with ``pip``:

.. code-block:: bash

pip install sphinx pydata-sphinx-theme

3. Make Changes to the Documentation
-------------------------------------
Edit or add ``.rst`` files in the ``docs/source`` directory. For example:

- Update ``index.rst`` to include new pages.
- Modify existing ``.rst`` files to update content.
- Add new ``.rst`` files for additional sections.

4. Build the Documentation Locally
-----------------------------------
Before committing your changes, build the documentation locally to ensure there are no errors:

.. code-block:: bash

cd docs
make html

This will generate the HTML files in the ``docs/build/html`` directory. Open the ``index.html`` file in your browser to preview the changes:

.. code-block:: bash

xdg-open build/html/index.html

5. Test the Documentation
--------------------------
- Verify that all links work correctly.
- Ensure the side menu and table of contents are updated.
- Check for any warnings or errors in the terminal output during the build process.

6. Commit Changes and Create a Pull Request
---------------------------------------------
Once you are satisfied with your changes, commit and push them to your fork. For detailed instructions,
refer to the following sections in the :ref:`Development Guidelines <development_guidelines>` page:
- :ref:`Commit Changes to Your Fork <commit-changes-to-your-fork>`
- :ref:`Create a Pull Request <create-a-pull-request>`

7. Verify Deployment
---------------------
After your pull request is merged, the GitHub Actions workflow will automatically build and deploy the updated documentation. Verify that the changes are live on GitHub Pages:

1. Go to the **Actions** tab in the main repository.
2. Check the logs for the ``deploy-docs.yml`` workflow to ensure it completed successfully.
3. Visit the GitHub Pages URL to confirm the updates.

Notes
-----
Loading