ctsm
  • 1. CTSM1 User's Guide
    • 1.1. Overview
    • 1.2. Setting Up and Running a Case
    • 1.3. Using CLM tools
    • 1.4. Adding New Resolutions
    • 1.5. Running Special Cases
    • 1.6. Running Single Point and Regional Cases
    • 1.7. Troubleshooting
    • 1.8. Testing
    • 1.9. Using mesh_maker
    • 1.10. Working with CTSM Documentation
      • 1.10.1. Working with the CTSM documentation
      • 1.10.2. Building and previewing the documentation on Casper (RECOMMENDED)
        • 1.10.2.1. Initial Casper setup
        • 1.10.2.2. Building docs on Casper
        • 1.10.2.3. Previewing docs on Casper
      • 1.10.3. Building and previewing the documentation on Mac
      • 1.10.4. Building and previewing the documentation on Windows
      • 1.10.5. Documentation style guide
      • 1.10.6. Tips for working with Markdown
      • 1.10.7. Tips for working with reStructuredText
      • 1.10.8. Common doc build errors and how to handle them
      • 1.10.9. Building multiple versions of the documentation
      • 1.10.10. ⚠️ Original docs documentation from the GitHub Wiki
  • 2. CLM Technical Note
  • 3. CTSM-LILAC User's Guide
ctsm
  • 1. CTSM1 User's Guide
  • 1.10. Working with CTSM Documentation
  • 1.10.2. Building and previewing the documentation on Casper (RECOMMENDED)
  • View page source

1.10.2. Building and previewing the documentation on Casper (RECOMMENDED)

  • Initial Casper setup

  • Building docs on Casper

  • Previewing docs on Casper

1.10.2.1. Initial Casper setup

You don't need to install any software! This is why Casper is the recommended method for building and previewing the docs.

1.10.2.2. Building docs on Casper

Casper uses the Podman software for running containers like the one we recommend for building the CTSM documentation. Make sure it's enabled before building: module load podman. Then do:

cd doc
./build_docs -b _build -c -d

This runs a complicated series of scripts and software that culminate in something called Sphinx converting the .rst and .md files into HTML webpages, all within the (new, if needed) _build directory.

The -c means "do a clean build." If you leave it off, Sphinx will only rebuild files it thinks have changed since the last time you built the docs, which is faster but can lead to problems. If you get unexpected results or errors without -c, rerunning with -c is the first troubleshooting step.

The -d means "run using the container." If you're not using the container and are instead using the ctsm_pylib Conda environment (not recommended), leave off -d, and make sure you've activated ctsm_pylib before running the above command.

(Do ./build_docs --help for more information and options.)

See the "Container software or Conda environment" sections for Mac or Windows for more information on these two methods.

Tip

[2026-04-07] If you get an error saying something like Error: could not find a working conmon binary, do this and retry:

module load ncarenv/24.12
module load podman

The bug making this necessary should hopefully be resolved soon. It has to do with the installation of podman in the module ncarenv/25.10; see this Slack thread for more information.

1.10.2.3. Previewing docs on Casper

There are a few different ways to do this.

1.10.2.3.1. Previewing docs on Casper with OnDemand

Tip

This will be somewhat easier if your CTSM checkout is in (or symlinked to) your home directory ($HOME).

The simplest way to preview your built documentation on Casper is to use NCAR's OnDemand service. After you open a new Casper Login VNC Desktop session, wait for it to start, then click the "Launch Casper Login VNC Desktop" button. This will open a Linux desktop in your browser. Click on the "Home" icon and navigate to your CTSM checkout, then the doc/_build/html directory, then open the index.html file. (If your checkout isn't in your home directory, you'll need to click on Devices > / in the sidebar of the window that opens, then navigate all the way to your checkout.) That should open it in the Linux desktop's Firefox, at which point you can browse around as usual.

If you rebuild the documentation but don't see your changes updated in the webpage, and the reload button doesn't work, you may need to navigate to a different page and then come back.

1.10.2.3.2. Previewing docs on Casper via SSH tunnel

If the OnDemand method doesn't work for whatever reason, open a terminal on your local machine and do this:

ssh YOUR_USERNAME@casper.hpc.ucar.edu echo $((10000 + $(id -u) % 50000))

This will print an integer that we will call YOUR_PORT.

Then open a new SSH connection to the server like so, replacing YOUR_PORT with the integer you got above:

ssh -L YOUR_PORT:localhost:YOUR_PORT YOUR_USERNAME@casper.hpc.ucar.edu

Once that's connected, we're going to spin up a web server. It's best to do this on a compute node rather than a login node. Use the qinteractive command to open an interactive session on a Casper compute node. (Find more info about qinteractive here.)

Once your interactive compute session is open, start the web server in it like so (again replacing YOUR_PORT):

cd /path/to/your/ctsm/repo
cd doc/_build/html
python3 -m http.server YOUR_PORT

Now you're ready to view your documentation! Just open a web browser on your computer and navigate to http://localhost:YOUR_PORT. You should see a rendered version of the documentation that you can browse as usual.

1.10.2.3.3. Fallback preview method

If neither of the above work, you can download the doc/_build/html directory to your computer (e.g., with scp or rsync) and open html/index.html in a web browser.

1.10.2.3.4. A note about previewing the docs

Note that there is a menu in the lower left of the webpage that lets readers switch between different versions of the documentation. The links to versions in this menu will not work when using the build command given above. If you wish to preview this version switching functionality, see Building multiple versions of the documentation.

Previous Next

© Copyright 2020, UCAR.

Built with Sphinx using a theme provided by Read the Docs.
Version: Latest development code
Versions
Latest development code
CLM5.0