Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update documentation styling for easier navigation #624

Merged
merged 13 commits into from
Mar 20, 2024
Merged
Show file tree
Hide file tree
Changes from 12 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
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,8 @@ conda-build/

# Ad-hoc QA
qa/

# Sphinx generated .txt files
notebook-examples.txt
team-panel.txt
demos.txt
9 changes: 0 additions & 9 deletions AUTHORS.rst

This file was deleted.

33 changes: 19 additions & 14 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -215,12 +215,21 @@ Xarray and Xarray usage in climate science!
- `Pangeo Forum <https://foundations.projectpythia.org/core/xarray.html>`_
- `Project Pythia <https://foundations.projectpythia.org/core/xarray.html>`_

Acknowledgement
---------------
Projects Using xCDAT
--------------------

Huge thank you to all of the xCDAT `contributors`_!
xCDAT is actively being integrated as a core component of the `Program for Climate Model
Diagnosis and Intercomparison (PCMDI) Metrics Package`_ and the `Energy Exascale Earth
System Model Diagnostics (E3SM) Package`_. xCDAT is also included in the `E3SM Unified
Anaconda Environment`_ that is deployed on various U.S. Department of Energy
supercomputers to run E3SM software tools.

.. _Program for Climate Model Diagnosis and Intercomparison (PCMDI) Metrics Package: https://pcmdi.github.io/pcmdi_metrics/
.. _Energy Exascale Earth System Model Diagnostics (E3SM) Package: https://e3sm-project.github.io/e3sm_diags/_build/html/main/index.html
.. _E3SM Unified Anaconda Environment: https://e3sm.org/resources/tools/other-tools/e3sm-unified-environment/

.. _contributors: https://github.com/xCDAT/xcdat/graphs/contributors
Acknowledgement
---------------

xCDAT is jointly developed by scientists and developers from the Energy Exascale
Earth System Model (`E3SM`_) Project and Program for Climate Model Diagnosis and
Expand All @@ -241,18 +250,14 @@ Environmental Research (`BER`_) within the `Department of Energy`_'s `Office of
.. _Department of Energy: https://www.energy.gov/
.. _Office of Science: https://science.osti.gov/

Projects Using xCDAT
--------------------
Contributors
------------

xCDAT is actively being integrated as a core component of the `Program for Climate Model
Diagnosis and Intercomparison (PCMDI) Metrics Package`_ and the `Energy Exascale Earth
System Model Diagnostics (E3SM) Package`_. xCDAT is also included in the `E3SM Unified
Anaconda Environment`_ that is deployed on various U.S. Department of Energy
supercomputers to run E3SM software tools.
Thank you to all of our contributors!

.. _Program for Climate Model Diagnosis and Intercomparison (PCMDI) Metrics Package: https://pcmdi.github.io/pcmdi_metrics/
.. _Energy Exascale Earth System Model Diagnostics (E3SM) Package: https://e3sm-project.github.io/e3sm_diags/_build/html/main/index.html
.. _E3SM Unified Anaconda Environment: https://e3sm.org/resources/tools/other-tools/e3sm-unified-environment/
.. image:: https://contrib.rocks/image?repo=xCDAT/xcdat
:alt: xCDAT contributors
:target: https://github.com/xCDAT/xcdat/graphs/contributors

License
-------
Expand Down
1 change: 1 addition & 0 deletions conda-env/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ dependencies:
- sphinx-book-theme
- sphinx-copybutton
- nbsphinx
- sphinx-design
- pandoc
- ipython # Required for nbsphinx syntax highlighting
- gsw-xarray # Required for vertical regridding example
Expand Down
4 changes: 4 additions & 0 deletions docs/_static/icons/book.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions docs/_static/icons/play.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions docs/_static/icons/plot.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions docs/_static/icons/wrench.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions docs/_static/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/* Main index page overview cards */

.sd-card-img-top {
width: 33% !important;
display: block;
margin-left: auto;
margin-right: auto;
margin-top: 10px;
}
Binary file added docs/_static/thumbnails/ams-logo.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_static/thumbnails/esgf2-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_static/thumbnails/llnl-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_static/thumbnails/regridding-vertical.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_static/thumbnails/spatial-avg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_static/thumbnails/temporal-average.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion docs/authors.rst

This file was deleted.

116 changes: 114 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,16 @@
# absolute, like shown here.
#
import os
import pathlib
import sys
from pathlib import Path
from typing import Dict
from textwrap import dedent, indent

import sphinx_autosummary_accessors
import yaml
from sphinx.application import Sphinx
from sphinx.util import logging

# A workaround that sets the "ESMFMKFILE" env variable for the Read The Docs
# build to work. Read The Docs does not activate the conda environment which
Expand All @@ -34,6 +39,8 @@
sys.path.insert(0, os.path.abspath("..")) # noqa: I001, I003
import xcdat # noqa: I001, E402

LOGGER = logging.getLogger("conf")

# -- General configuration ---------------------------------------------

# If your documentation needs a minimal Sphinx version, state it here.
Expand All @@ -50,6 +57,7 @@
"sphinx_autosummary_accessors",
"sphinx_copybutton",
"nbsphinx",
"sphinx_design",
]

# autosummary and autodoc configurations
Expand Down Expand Up @@ -160,7 +168,7 @@
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ["_static"]

html_css_files = ["style.css"]

# -- Options for HTMLHelp output ---------------------------------------

Expand Down Expand Up @@ -224,5 +232,109 @@ def html_page_context(app, pagename, templatename, context, doctree):
context["theme_use_edit_page_button"] = False


def setup(app):
def update_team(app: Sphinx):
"""Update the team members list."""

LOGGER.info("Updating team members page...")

team = yaml.safe_load(pathlib.Path(app.srcdir, "team.yml").read_bytes())
items = []
for member in team:
item = f"""
.. grid-item-card::
:text-align: center
:link: https://github.com/{member['gh_login']}

.. image:: {member['avatar']}
:alt: {member['name']}
+++
{member['name']}
"""
items.append(item)

items_md = indent(dedent("\n".join(items)), prefix=" ")

markdown = f"""
.. grid:: 1 2 3 3
:gutter: 2

{items_md}
"""

pathlib.Path(app.srcdir, "team-panel.txt").write_text(markdown)
LOGGER.info("Team members page updated.")


def update_gallery(app: Sphinx):
"""Update the gallery of examples notebooks."""

LOGGER.info("Updating gallery page...")

notebooks = yaml.safe_load(pathlib.Path(app.srcdir, "gallery.yml").read_bytes())

items = [
f"""
.. grid-item-card::
:text-align: center
:link: {item['path']}

.. image:: {item['thumbnail']}
:alt: {item['title']}
+++
{item['title']}
"""
for item in notebooks
]

items_md = indent(dedent("\n".join(items)), prefix=" ")
markdown = f"""
.. grid:: 1 2 3 3
:gutter: 2

{items_md}
"""

pathlib.Path(app.srcdir, "notebook-examples.txt").write_text(markdown)

LOGGER.info("Gallery page updated.")


def update_demos(app: Sphinx):
"""Update the demos page."""

LOGGER.info("Updating demos page...")

links = yaml.safe_load(pathlib.Path(app.srcdir, "demos.yml").read_bytes())

items = [
f"""
.. grid-item-card::
:text-align: center
:link: {item['path']}

.. image:: {item['thumbnail']}
:alt: {item['title']}
+++
{item['title']}
"""
for item in links
]

items_md = indent(dedent("\n".join(items)), prefix=" ")
markdown = f"""
.. grid:: 1 2 3 3
:gutter: 2

{items_md}
"""

pathlib.Path(app.srcdir, "demos.txt").write_text(markdown)

LOGGER.info("Demos page updated.")


def setup(app: Sphinx):
app.connect("html-page-context", html_page_context)
app.connect("builder-inited", update_team)
app.connect("builder-inited", update_gallery)
app.connect("builder-inited", update_demos)
4 changes: 3 additions & 1 deletion docs/demos.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ Presentations and Demos

This page includes relevant xCDAT presentations, demos, and papers.

.. include:: demos.txt

.. toctree::
:maxdepth: 2
:hidden:

AMS 2023 Abstract <https://ams.confex.com/ams/103ANNUAL/meetingapp.cgi/Paper/412648>
demos/1-25-23-cwss-seminar/introduction-to-xcdat.ipynb
A Gentle Introduction to xCDAT (Xarray Climate Data Analysis Tools) - Video introduction <https://youtu.be/sJpQ9vKDKa8?feature=shared>
ESGF2 - A Gentle Introduction to xCDAT (video introduction) <https://youtu.be/sJpQ9vKDKa8?feature=shared>
11 changes: 11 additions & 0 deletions docs/demos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
- title: AMS 2023 Abstract
path: https://ams.confex.com/ams/103ANNUAL/meetingapp.cgi/Paper/412648
thumbnail: _static/thumbnails/ams-logo.jpg

- title: LLNL Climate and Weather Seminar Series (01/25/2023) - A Gentle Introduction to xCDAT
path: demos/1-25-23-cwss-seminar/introduction-to-xcdat.ipynb
thumbnail: _static/thumbnails/llnl-logo.png

- title: ESGF2 - A Gentle Introduction to xCDAT (video introduction)
path: https://youtu.be/sJpQ9vKDKa8?feature=shared
thumbnail: _static/thumbnails/esgf2-logo.png
2 changes: 1 addition & 1 deletion docs/examples/general-utilities.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -4564,7 +4564,7 @@
"\n",
"Helpful knowledge:\n",
"\n",
"- This API uses `cf_xarray` to interpret CF axis names and coordinate names in the xarray object attributes. Refer to [Metadata Interpretation](../faqs.rst) for more information.\n",
"- This API uses `cf_xarray` to interpret CF axis names and coordinate names in the xarray object attributes. Refer to [Metadata Interpretation](../getting-started-guide/faqs.rst) for more information.\n",
"\n",
"Xarray documentation on coordinates ([source](https://docs.xarray.dev/en/stable/user-guide/data-structures.html#coordinates)):\n",
"\n",
Expand Down
4 changes: 2 additions & 2 deletions docs/gallery.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
Gallery
=======

This gallery demonstrates how to use some of the features in ``xcdat``. Contributions are highly welcomed and appreciated.
Please checkout the :doc:`contributing` guide.
This gallery demonstrates how to use some of the features in ``xcdat``. Contributions are highly welcomed and appreciated. Please checkout the :doc:`contributing` guide.

.. include:: notebook-examples.txt

.. toctree::
:maxdepth: 2
Expand Down
27 changes: 27 additions & 0 deletions docs/gallery.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
- title: A Gentle Introduction to xCDAT (Xarray Climate Data Analysis Tools)
path: examples/introduction-to-xcdat.ipynb
thumbnail: _static/xcdat-logo.png

- title: General Dataset Utilities
path: examples/general-utilities.ipynb
thumbnail: _static/dataset-diagram.webp

- title: Calculate Geospatial Weighted Averages from Monthly Time Series
path: examples/spatial-average.ipynb
thumbnail: _static/thumbnails/spatial-avg.png

- title: Calculate Time Averages from Time Series Data
path: examples/temporal-average.ipynb
thumbnail: _static/thumbnails/temporal-average.png

- title: Calculate Climatology and Departures from Time Series Data
path: examples/climatology-and-departures.ipynb
thumbnail: _static/thumbnails/climatology-and-departures.png

- title: Horizontal Regridding
path: examples/regridding-horizontal.ipynb
thumbnail: _static/thumbnails/regridding-horizontal.png

- title: Vertical Regridding
path: examples/regridding-vertical.ipynb
thumbnail: _static/thumbnails/regridding-vertical.png
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ Setting up your xCDAT environment
Ensure ``conda`` is installed
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Generally, the instructions from `getting started guide <getting-started.rst>`_ can also
be followed for HPC machines. This guide covers installing Miniconda3 and creating
a conda environment with the ``xcdat`` package.
Generally, the installation instructions from the `Installation <../installation.rst>`_
page can also be followed for HPC machines. This guide covers installing Miniconda3 and
creating a conda environment with the ``xcdat`` package.

Before installing Miniconda3, you should consult your HPC documentation to see if
``conda`` is already available; in some cases, ``python`` and ``conda`` may be
Expand Down Expand Up @@ -101,4 +101,4 @@ kernel. You should then be able to use your ``xcdat`` environment on Jupyter.

|image0|

.. |image0| image:: _static/jupyter-launcher-example.png
.. |image0| image:: ../_static/jupyter-launcher-example.png
14 changes: 14 additions & 0 deletions docs/getting-started-guide/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
################
Getting Started
################

The getting started guide aims to get you using xCDAT productively as quickly as possible.

.. toctree::
:maxdepth: 2
:hidden:

Project Overview <overview>
Installation <installation>
xCDAT on HPC / Jupyter <getting-started-hpc-jupyter>
faqs
Loading
Loading