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

[WIP] Add hillslope scripts (to python/ctsm/) and external, plus docs #2425

Draft
wants to merge 181 commits into
base: b4b-dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 168 commits
Commits
Show all changes
181 commits
Select commit Hold shift + click to select a range
af111d1
Add representative-hillslopes external (optional) in tools/external/.
samsrabin Feb 20, 2024
f00c21c
UNTESTED! Bring in CTSM-specific hillslope Python scripts.
samsrabin Feb 20, 2024
697559b
synthetic_hillslope: Remove unused bits.
samsrabin Mar 18, 2024
e6e3b38
synthetic_hillslope: Add basic input arguments.
samsrabin Mar 18, 2024
8c9024c
synthetic_hillslope: Save settings as netCDF attributes.
samsrabin Mar 18, 2024
f662e56
synthetic_hillslope: Change hard-coded settings to command-line options.
samsrabin Mar 18, 2024
bc9ed36
synthetic_hillslope: Remove check_file_permissions().
samsrabin Mar 18, 2024
5d54aeb
synthetic_hillslope: Remove unused code re: timetag.
samsrabin Mar 18, 2024
a7515e0
synthetic_hillslope: Use shutil.copyfile() instead of subprocess.
samsrabin Mar 18, 2024
f05fcbc
synthetic_hillslope: Format with black.
samsrabin Mar 18, 2024
66e6045
Add previous commit to .git-blame-ignore-revs.
samsrabin Mar 18, 2024
86aa9a3
synthetic_hillslope: Factor out create_variables(), write_to_file().
samsrabin Mar 18, 2024
60b71b0
synthetic_hillslope: Rename f and w to infile and outfile.
samsrabin Mar 18, 2024
e021680
synthetic_hillslope: Add docstrings.
samsrabin Mar 18, 2024
d4b1bcb
Simplify calculation of aspect.
samsrabin Mar 18, 2024
92e655f
synthetic_hillslope: Reduce nesting in i-j loop.
samsrabin Mar 18, 2024
e28e757
synthetic_hillslope: Define *cosp_height() functions outside main().
samsrabin Mar 18, 2024
4a7377c
synthetic_hillslope: Don't check hcase is slope_aspect; that's handle…
samsrabin Mar 19, 2024
d87ab72
synthetic_hillslope: More refactoring to reduce size of main().
samsrabin Mar 19, 2024
cc47ddd
synthetic_hillslope: Resolve pylint complaint about netCDF4.Dataset().
samsrabin Mar 19, 2024
db46dce
synthetic_hillslope: Actually close outfile.
samsrabin Mar 19, 2024
ddd2790
synthetic_hillslope: Suppress a pointless-string-statement warning.
samsrabin Mar 19, 2024
8a2fda7
synthetic_hillslope: Functionize define_hillslope_geom_arrays().
samsrabin Mar 19, 2024
65ed60d
synthetic_hillslope: Rename im and jm to n_lon and n_lat.
samsrabin Mar 19, 2024
eb4906d
Run python/ctsm/hillslopes/ through black formatter.
samsrabin Mar 20, 2024
e57d3f0
Add previous commit to .git-blame-ignore-revs.
samsrabin Mar 20, 2024
92b761c
combine_gridcell_files: Clean up top of module.
samsrabin Mar 20, 2024
077b131
combine_gridcell_files: Split into parse_args() and main().
samsrabin Mar 20, 2024
37b0718
Hillslope scripts: Replace use of stop.
samsrabin Mar 20, 2024
51b7b9c
combine_gridcell_files: Split out write_to_file() and create_variable…
samsrabin Mar 21, 2024
c80f08d
combine_gridcell_files: Move options to arguments.
samsrabin Mar 21, 2024
3f60e61
combine_gridcell_files: Fix variable names in read-in netCDF.
samsrabin Mar 21, 2024
02318dd
Share create_variables code between hillslope scripts.
samsrabin Mar 21, 2024
08b8f7a
combine_gridcell_files: Suppress pylint warning about netCDF4.Dataset.
samsrabin Mar 21, 2024
fa98b49
combine_gridcell_files: Add a docstring.
samsrabin Mar 21, 2024
bfceccb
combine_gridcell_files: Don't use subprocess.
samsrabin Mar 21, 2024
6530250
synthetic_hillslope: Use LANDFRAC_PFT instead of PFTDATA_MASK.
samsrabin Mar 21, 2024
017a06e
combine_gridcell_files: Simplify some booleans.
samsrabin Mar 21, 2024
a0784ab
combine_gridcell_files: Improve variable names.
samsrabin Mar 21, 2024
0982051
combine_gridcell_files: Don't assume Unix filepath separators.
samsrabin Mar 21, 2024
fa96067
Replace loop_call.py with functionality in combine_gridcell_files.
samsrabin Mar 21, 2024
2aa15f3
combine_chunk_files: Remove some unneeded stuff.
samsrabin Mar 21, 2024
34c59cd
combine_chunk_files: Turn options into arguments.
samsrabin Mar 21, 2024
f34c261
combine_chunk_files: Add --overwrite flag.
samsrabin Mar 21, 2024
21ca682
combine_chunk_files: Add --verbose flag.
samsrabin Mar 21, 2024
f0d34eb
combine_chunk_files: Reduce nesting.
samsrabin Mar 21, 2024
79b0a0d
combine_chunk_files: Include dem_source.
samsrabin Mar 21, 2024
5a54585
combine_chunk_files: Fix an error msg.
samsrabin Mar 22, 2024
50d298f
combine_chunk_files: Don't use subprocess.
samsrabin Mar 22, 2024
a816cf6
Point representative-hillslopes external at Sean's branch.
samsrabin Mar 22, 2024
e0395d1
combine_gridcell_files: 58 statements is OK.
samsrabin Mar 22, 2024
2bf1fc6
"pylint: disable=no-name-in-module" for importing netCDF4.Dataset.
samsrabin Apr 2, 2024
63c4873
combine_chunk_files: Reformat with black.
samsrabin Apr 2, 2024
65ecbeb
Add previous commit to .git-blame-ignore-revs.
samsrabin Apr 2, 2024
c74d848
combine_chunk_files: Reduce nesting.
samsrabin Apr 2, 2024
54e5abb
Convenience functions for making hillslope variables.
samsrabin Apr 2, 2024
9a94ab0
combine_chunk_files: Remove unused variable 'command'.
samsrabin Apr 2, 2024
dc0add9
combine_chunk_files: Simplify top of loop thru chunks.
samsrabin Apr 2, 2024
f1ce7e6
combine_chunk_files: Rename initializeArrays to arrays_uninitialized.
samsrabin Apr 2, 2024
27c2567
combine_chunk_files: Simplify some booleans.
samsrabin Apr 2, 2024
eb03d81
combine_chunk_files: Rename addBedrock and addStream for pylint.
samsrabin Apr 2, 2024
c931942
combine_chunk_files: Move variable fill to immediately after creation.
samsrabin Apr 2, 2024
68b17cc
combine_chunk_files: Save just hillslope_file. Use xarray.
samsrabin Apr 3, 2024
7b67d61
Add --n-bins arg to combine_chunk_files and combine_gridcell_files.
samsrabin Apr 3, 2024
75c9ca4
combine_chunk_files: Use trapezoid instead of section_quad files.
samsrabin Apr 3, 2024
752a1c7
combine_chunk_files: Remove coordinate vars nmaxhillcol and nhillslope.
samsrabin Apr 3, 2024
8f108b8
combine_chunk_files: Save as netCDF4-classic.
samsrabin Apr 3, 2024
060a66d
combine_gridcell_files: Improve --n-bins description.
samsrabin Apr 3, 2024
589877b
Add --hillslope-form to combine_gridcell_files and combine_chunk_files.
samsrabin Apr 3, 2024
89e25bd
combine_chunk_files: Functionize read_hillslope_vars().
samsrabin Apr 3, 2024
f27f7de
combine_chunk_files: Remove unused variable h_pftndx.
samsrabin Apr 3, 2024
712c566
combine_chunk_files: Refactor into class HillslopeVars.
samsrabin Apr 4, 2024
8f92840
combine_chunk_files: Resolve variable name pylint complaints.
samsrabin Apr 4, 2024
a880ed7
Split HillslopeVars.read() into versions for old/new varnames.
samsrabin Apr 4, 2024
9e8fae1
combine_chunk_files: Remove unused imports.
samsrabin Apr 4, 2024
fee572c
Add wrapper script tools/hillslopes/combine_chunk_files.
samsrabin Apr 4, 2024
ef103b1
Add tools/external/ to .gitignore.
samsrabin Apr 4, 2024
063a6d9
synthetic_hillslope now saves hillslope_file instead of fsurdat.
samsrabin Apr 4, 2024
bc4304c
combine_chunk_files: Don't use xarray.
samsrabin Apr 4, 2024
3a4fe27
Move HillslopeVars to hillslope_utils.
samsrabin Apr 4, 2024
66eba03
combine_gridcell_files: Use HillslopeVars.
samsrabin Apr 4, 2024
1958107
combine_gridcell_files: Only read hillslope data dimensions/settings …
samsrabin Apr 4, 2024
0eb3ad1
HillslopeVars: Mark internal functions with leading underscore.
samsrabin Apr 4, 2024
6218aee
Rename sjm and sim to n_lat and n_lon.
samsrabin Apr 5, 2024
6789c15
Bugfix for HillslopeVars.update() default arg.
samsrabin Apr 5, 2024
fb53d01
Bugfix: Use of chunk_mask in HillslopeVars.update().
samsrabin Apr 5, 2024
d3e9a43
combine_chunk_files.py: Bugfix for --n-chunks argparse.
samsrabin Apr 16, 2024
ec82aa3
hillslope_utils.py: Use NETCDF_FORMAT constant.
samsrabin Apr 16, 2024
a9e05b0
hillslope_utils.py: Functionize add_longxy_latixy_nc().
samsrabin Apr 16, 2024
c89600c
combine_chunk_files.py: Save LATIXY and LONGXY.
samsrabin Apr 16, 2024
a3287e1
hillslope_utils.py: Change LONGXY/LATIXY metadata to match fsurdat.
samsrabin Apr 16, 2024
ff58969
combine_chunk_files.py: Save AREA.
samsrabin Apr 16, 2024
fb2caaf
combine_chunk_files.py: Add input_file and creation_date.
samsrabin Apr 16, 2024
0fc80f5
combine_chunk_files.py: Functionize finish_saving().
samsrabin Apr 16, 2024
0261c18
hillslope_utils.py: Functionize _remove_hillslope_data().
samsrabin Apr 16, 2024
7053b29
Reformat hillslope scripts with black.
samsrabin Apr 16, 2024
71be2e7
Add previous commit to .git-blame-ignore-revs.
samsrabin Apr 16, 2024
a981e69
synthetic_hillslope.py: Remove unused import shutil.
samsrabin Apr 16, 2024
90e4810
synthetic_hillslope.py: Resolve a few pylint complaints.
samsrabin Apr 16, 2024
b4a78e7
synthetic_hillslope.py: Add default info to --help.
samsrabin Apr 16, 2024
90e1dfe
synthetic_hillslopes: Use HillslopeVars.
samsrabin Apr 25, 2024
5643e3f
synthetic_hillslope: Use context manager to open input file.
samsrabin Apr 25, 2024
dc2cd68
Improve hillslope script --help outputs.
samsrabin Apr 25, 2024
179e2ee
Format with black.
samsrabin Sep 9, 2024
8be2c38
Add previous commit to .git-blame-ignore-revs.
samsrabin Sep 9, 2024
d7bd49c
Refactor: New functions in synthetic_hillslope to satisfy pylint.
samsrabin Sep 9, 2024
5bbdf89
Resolve or ignore invalid-name pylint warning in synthetic_hillslope.
samsrabin Sep 9, 2024
25292b6
synthetic_hillslopes: Copy Dataset_Version from original.
samsrabin Sep 9, 2024
7ad47fd
synthetic_hillslope: Add optional --fsurdat flag to save fsurdat inst…
samsrabin Sep 9, 2024
005b7fa
Dataset_Version no longer needed manually.
samsrabin Sep 9, 2024
2918296
combine_gridcell_files: Improve description of --overwrite.
samsrabin Sep 23, 2024
8fdd12a
combine_gridcell_files: Remove --n-chunks argument.
samsrabin Sep 23, 2024
f391c75
combine_gridcell_files: Improve description.
samsrabin Sep 23, 2024
0fac7b9
combine_chunk_files: Improve description.
samsrabin Sep 23, 2024
9920c82
Functionize get_chunks_to_process(); move to hillslope_utils.
samsrabin Sep 23, 2024
04217bc
combine_chunk_files: Remove --n-chunks argument.
samsrabin Sep 23, 2024
39e1841
Bugfix to make get_mask_var work in combine_chunk_files.
samsrabin Sep 23, 2024
c3d1bbc
combine_chunk_files: Throw error if no files found.
samsrabin Sep 23, 2024
b868d05
combine_chunk_files: Work on surface datasets w/o PFTDATA_MASK.
samsrabin Sep 23, 2024
737d6dc
Remove a troubleshooting print().
samsrabin Sep 23, 2024
9105ca8
combine_chunk_files: Work on surface datasets w/o AREA.
samsrabin Sep 23, 2024
54a93ed
combine_chunk_files: Add a docstring.
samsrabin Sep 23, 2024
3fdea34
synthetic_hillslope.py: Add date suffix to default output.
samsrabin Oct 1, 2024
f510b4d
synthetic_hillslope.py: Copy LATIXY/LONGXY to output.
samsrabin Oct 1, 2024
bca4618
Point doc-builder to my fork. Avoid old fork of sphinx_rtd_theme.
samsrabin Oct 3, 2024
4c2361d
Resolve some sphinx warnings.
samsrabin Oct 3, 2024
490d229
Fix MOSART conceptual figure references.
samsrabin Oct 3, 2024
4a9e1a2
Replace a reference to RTM with MOSART.
samsrabin Oct 3, 2024
497e991
Resolve "WARNING: unsupported theme option 'versions' given"
samsrabin Oct 3, 2024
3511baa
Add sphinx_mdinclude.
samsrabin Oct 3, 2024
dcb2f0f
Add ctsm-docs.yml.
samsrabin Oct 3, 2024
94874d2
Replace ctsm-docs.yml with equivalent requirements.txt.
samsrabin Oct 3, 2024
5f54b61
Copy CIME's docs.yml workflow to our repo.
samsrabin Oct 3, 2024
18598eb
Update docs.yml with our URL.
samsrabin Oct 3, 2024
e95c291
Pare down doc/requirements.txt.
samsrabin Oct 3, 2024
c3788bb
Have PR preview actions run even on branches from forks
samsrabin Oct 3, 2024
674ab46
Add pages:write perms to build-and-deploy action.
samsrabin Oct 3, 2024
a5063f6
Update peaceiris/actions-gh-pages from v3 to v4.
samsrabin Oct 3, 2024
a5f4573
Set gibberish publish_branch.
samsrabin Oct 3, 2024
442f13d
Set external_repository to hopefully publish to user's fork.
samsrabin Oct 3, 2024
76c3238
Remove pages preview/push stuff; only check docs build.
samsrabin Oct 3, 2024
03857ff
Remove write perms for test-build action.
samsrabin Oct 3, 2024
dccbcdd
Delete cleanup job.
samsrabin Oct 3, 2024
868e0d0
If PR branch is from ESCOMP/CTSM (not fork), run build-and-deploy.
samsrabin Oct 3, 2024
1fa1eb5
Only do test-build if the PR branch is from a fork, not ESCOMP/CTSM.
samsrabin Oct 3, 2024
9d5a455
build_docs will now fail if sphinx warnings are generated.
samsrabin Oct 3, 2024
ee94753
TEST: Introduce Sphinx errors. Github workflow should fail.
samsrabin Oct 3, 2024
a893eb5
docs.yml now fails when sphinx has warnings.
samsrabin Oct 4, 2024
dc8dd92
Revert "Only do test-build if the PR branch is from a fork, not ESCOM…
samsrabin Oct 4, 2024
adb99fc
Add docs.yml job to test doc-builder.
samsrabin Oct 4, 2024
da0a8bd
Fix SPHINXOPTS in test-build-makefile.
samsrabin Oct 4, 2024
3575ea4
Fix working dir of test-doc-builder.
samsrabin Oct 4, 2024
6fb71bc
Revert "TEST: Introduce Sphinx errors. Github workflow should fail."
samsrabin Oct 4, 2024
8bbdf94
TEST: Introduce Sphinx errors. Github workflow should fail.
samsrabin Oct 3, 2024
eb74874
Revert "TEST: Introduce Sphinx errors. Github workflow should fail."
samsrabin Oct 4, 2024
6a3049e
Disable "Push new docs."
samsrabin Oct 4, 2024
259ad13
Disable "needs: cleanup" for build-and-deploy.
samsrabin Oct 4, 2024
afd87b6
Publish preview to gh-pages-preview instead of gh-pages.
samsrabin Oct 4, 2024
71c4386
Delete docs cleanup and build-and-deploy jobs.
samsrabin Oct 7, 2024
76e2c6e
Docs workflow should run on PRs going to b4b-dev too.
samsrabin Oct 7, 2024
2d60500
Remove action version specifiers from docs workflow.
samsrabin Oct 7, 2024
b7c888e
Remove branches specifiers from docs workflow.
samsrabin Oct 7, 2024
0752bec
Revert "Remove action version specifiers from docs workflow."
samsrabin Oct 7, 2024
5fed746
Revert doc-builder to canonical v1.0.8.
samsrabin Oct 7, 2024
490f88f
Merge branch 'update-docs-builder-2' into hillslope-scripts-2
samsrabin Oct 8, 2024
3a0394c
Point doc-builder at my branch.
samsrabin Oct 8, 2024
5f8f958
Point representative-hillslopes submodule at my branch.
samsrabin Oct 8, 2024
46fbfce
Add User's Guide page: creating-hillslope-datasets.rst.
samsrabin Oct 8, 2024
9ab3e6b
Actually add representative-hillslopes external.
samsrabin Oct 11, 2024
4b03f5a
Format hillslopes scripts with black.
samsrabin Oct 11, 2024
cb2363a
Add previous commit to .git-blame-ignore-revs.
samsrabin Oct 11, 2024
2c5f3ea
build_docs script now exits with error if anything goes wrong.
samsrabin Oct 11, 2024
96f7ac5
Download submods in docs.yml.
samsrabin Oct 13, 2024
b7b9183
Update git-fleximod to v0.9.2; fixes g-f update -o call.
samsrabin Oct 13, 2024
e12bd1e
Docs build test: Call git-fleximod in its own step.
samsrabin Oct 13, 2024
4bce938
Docs build check: Remove .git/hooks to avoid git-lfs error.
samsrabin Oct 13, 2024
c6df412
Add system tests for CTSM hillslope scripts.
samsrabin Oct 14, 2024
61122a2
Hillslope scripts now use CTSM logging.
samsrabin Oct 15, 2024
ae15b23
Exercise a bit more of the CTSM-specific hillslope scripts.
samsrabin Oct 15, 2024
c7dbb53
Add another check to test_combine_gridcell_files().
samsrabin Oct 15, 2024
a6af9ac
Edit paths in creating-hillslope-datasets.rst.
samsrabin Oct 15, 2024
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
6 changes: 6 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ e4d38681df23ccca0ae29581a45f8362574e0630
a9d96219902cf609636886c7073a84407f450d9a
d866510188d26d51bcd6d37239283db690af7e82
0dcd0a3c1abcaffe5529f8d79a6bc34734b195c7
179e2eeb1ad919539e21f92947fcc80c9b054869
e096358c832ab292ddfd22dd5878826c7c788968
475831f0fb0e31e97f630eac4e078c886558b61c
fd5f177131d63d39e79a13918390bdfb642d781e
Expand All @@ -36,6 +37,11 @@ fd5f177131d63d39e79a13918390bdfb642d781e
183fc26a6691bbdf87f515dc47924a64be3ced9b
6fccf682eaf718615407d9bacdd3903b8786a03d
2500534eb0a83cc3aff94b30fb62e915054030bf
# Ran individual files through black python formatter
f05fcbc10eda44e574de7554c8ac2b0417215b61
eb4906d8ee78b4f5ad5b3b990c414f6e113b661f
63c4873eab8af9fdd1f89bfe0a5416dcc53394fa
7053b2980da08bb46f82d9cf1a5c4c63b98b37f6
78d05967c2b027dc9776a884716597db6ef7f57c
47839a77229c61555e3b8932927bb54cdc511b27
a0d014fae9550dd9ffbc934abd29ef16176f8208
Expand Down
74 changes: 74 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: docs

on:
push:
paths:
- 'doc/**'

pull_request:
paths:
- 'doc/**'

workflow_dispatch:

permissions:
contents: read
jobs:

test-build-makefile:
if: ${{ always() }}
name: Test building documentation with makefile
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
lfs: true
- name: Install python 3.x
uses: actions/setup-python@v2
with:
python-version: '3.x'
# https://github.com/actions/cache/blob/main/examples.md#python---pip
- name: Cache pip
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('doc/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
pip install -r doc/requirements.txt
# Build documentation under ${PWD}/_build
- name: Build Sphinx docs with makefile
run: |
make SPHINXOPTS="-W --keep-going" BUILDDIR=${PWD}/_build -C doc/ html

test-doc-builder:
if: ${{ always() }}
name: Test building documentation with doc-builder
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
lfs: true
- name: Install python 3.x
uses: actions/setup-python@v2
with:
python-version: '3.x'
# https://github.com/actions/cache/blob/main/examples.md#python---pip
- name: Cache pip
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('doc/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
pip install -r doc/requirements.txt
# Build documentation under ${PWD}/_build
- name: Build Sphinx docs with doc-builder
run: |
cd doc && ./build_docs -b ${PWD}/_build -c
16 changes: 16 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
# directories checked out by manage_externals, and other files created
# by manage_externals
manage_externals.log
ccs_config
/src/fates/
/cime/
/components/
/libraries/
/share/
/doc/doc-builder/
/tools/external/

# ignore svn directories
**/.svn/**
.svn/

# netcdf files
*.nc
# but don't ignore netcdf files here:
Expand Down
12 changes: 10 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,16 @@ fxDONOTUSEurl = https://github.com/NCAR/ParallelIO

[submodule "doc-builder"]
path = doc/doc-builder
url = https://github.com/ESMCI/doc-builder
fxtag = v1.0.8
url = https://github.com/samsrabin/doc-builder
fxtag = c51795f65d230803418c932bfd8639c85c33a19a
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Change this back to ESMCI repo, not my fork. Waiting on updates there that (a) treat sphinx warnings as errors and (b) point to an updated version of the escomp/base container that includes sphinx-mdinclude (see this comment).

fxrequired = ToplevelOptional
# Standard Fork to compare to with "git fleximod test" to ensure personal forks aren't committed
fxDONOTUSEurl = https://github.com/ESMCI/doc-builder

[submodule "representative-hillslopes"]
path = tools/external/representative-hillslopes
url = https://github.com/samsrabin/Representative_Hillslopes
fxtag = 2126ffe018b2268ed479469421763cbb45d9c264
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fxrequired = ToplevelOptional
# Standard Fork to compare to with "git fleximod test" to ensure personal forks aren't committed
fxDONOTUSEurl = https://github.com/swensosc/Representative_Hillslopes
2 changes: 1 addition & 1 deletion doc/doc-builder
4 changes: 4 additions & 0 deletions doc/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
esbonio == 0.16.4
sphinx == 7.2.6
sphinx-mdinclude == 0.6.2
sphinx_rtd_theme == 2.0.0
37 changes: 0 additions & 37 deletions doc/source/_static/pop_ver.js

This file was deleted.

3 changes: 0 additions & 3 deletions doc/source/_templates/layout.html

This file was deleted.

64 changes: 64 additions & 0 deletions doc/source/_templates/versions.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{% if READTHEDOCS or display_lower_left %}
{# Add rst-badge after rst-versions for small badge style. #}
<script type="text/javascript">
let baseUriRegex = /(.*\/cime)\/.*/g;
let parsedUri = baseUriRegex.exec(document.baseURI);

if (parsedUri != null && parsedUri.length == 2) {
let baseUri = parsedUri[1];

$.get(`${baseUri}/versions/versions.json`, function(data) {
let versionElement = $("#versions");

Object.keys(data).forEach(function(key) {
let value = data[key];

let item = `<dd><a href="${baseUri}/versions/${key}/html/">${value}</a></dd>`

versionElement.append(item);
});
});
}
</script>
<div class="rst-versions" data-toggle="rst-versions" role="note" aria-label="versions">
<span class="rst-current-version" data-toggle="rst-current-version">
<span class="fa fa-book"> Read the Docs</span>
v: {{ current_version }}
<span class="fa fa-caret-down"></span>
</span>
<div class="rst-other-versions">
{% if languages|length >= 1 %}
<dl>
<dt>{{ _('Languages') }}</dt>
{% for slug, url in languages %}
{% if slug == current_language %} <strong> {% endif %}
<dd><a href="{{ url }}">{{ slug }}</a></dd>
{% if slug == current_language %} </strong> {% endif %}
{% endfor %}
</dl>
{% endif %}
<dl id="versions">
<dt>Versions</dt>
</dl>
{% if downloads|length >= 1 %}
<dl>
<dt>{{ _('Downloads') }}</dt>
{% for type, url in downloads %}
<dd><a href="{{ url }}">{{ type }}</a></dd>
{% endfor %}
</dl>
{% endif %}
{% if READTHEDOCS %}
<dl>
<dt>{{ _('On Read the Docs') }}</dt>
<dd>
<a href="//{{ PRODUCTION_DOMAIN }}/projects/{{ slug }}/?fromdocs={{ slug }}">{{ _('Project Home') }}</a>
</dd>
<dd>
<a href="//{{ PRODUCTION_DOMAIN }}/builds/{{ slug }}/?fromdocs={{ slug }}">{{ _('Builds') }}</a>
</dd>
</dl>
{% endif %}
</div>
</div>
{% endif %}
31 changes: 23 additions & 8 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
#
import os
import sys
# Note that we need a specific version of sphinx_rtd_theme. This can be obtained with:
# pip install git+https://github.com/esmci/sphinx_rtd_theme.git@version-dropdown-with-fixes
import sphinx_rtd_theme
# sys.path.insert(0, os.path.abspath('.'))

Expand All @@ -37,7 +35,9 @@
'sphinx.ext.autodoc',
'sphinx.ext.todo',
'sphinx.ext.coverage',
'sphinx.ext.githubpages']
'sphinx.ext.githubpages',
'sphinx_mdinclude',
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
Expand Down Expand Up @@ -80,7 +80,7 @@
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
language = "en"

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
Expand Down Expand Up @@ -109,9 +109,10 @@
# names to html links. The current version can link to the current location (i.e., do
# nothing). For the other version, we just add a place-holder; its name and value are
# unimportant because these versions will get replaced dynamically.
html_theme_options = {}
html_theme_options['versions'] = {version: ''}
html_theme_options['versions']['[placeholder]'] = ''
### Sam Rabin 2024-10-02: Commented out to resolve "WARNING: unsupported theme option 'versions' given". Might break things!
### html_theme_options = {}
### html_theme_options['versions'] = {version: ''}
### html_theme_options['versions']['[placeholder]'] = ''

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
Expand Down Expand Up @@ -178,7 +179,7 @@


# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {'https://docs.python.org/': None}
intersphinx_mapping = {'python': ('https://docs.python.org/', None)}

numfig = True
numfig_format = {'figure': 'Figure %s',
Expand All @@ -190,3 +191,17 @@

def setup(app):
app.add_css_file('css/custom.css')

try:
html_context
except NameError:
html_context = dict()

html_context["display_lower_left"] = True

html_context["current_language"] = language

current_version = "master"

html_context["current_version"] = current_version
html_context["version"] = current_version
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,7 @@ Note that :math:`w_{target}` is truly supposed to give the target soil moisture

:math:`N_{irr}` is the index of the soil layer corresponding to a specified depth :math:`z_{irrig}` (:numref:`Table Irrigation parameters`) and :math:`\Delta z_{j}` is the thickness of the soil layer in layer :math:`j` (section :numref:`Vertical Discretization`). :math:`\theta_{j}` is the volumetric soil moisture in layer :math:`j` (section :numref:`Soil Water`). :math:`\theta_{target}` and :math:`\theta_{wilt}` are the target and wilting point volumetric soil moisture values, respectively, and are determined by inverting :eq:`7.94` using soil matric potential parameters :math:`\Psi_{target}` and :math:`\Psi_{wilt}` (:numref:`Table Irrigation parameters`). After the soil moisture deficit :math:`D_{irrig}` is calculated, irrigation in an amount equal to :math:`\frac{D_{irrig}}{T_{irrig}}` (mm/s) is applied uniformly over the irrigation period :math:`T_{irrig}` (s). Irrigation water is applied directly to the ground surface, bypassing canopy interception (i.e., added to :math:`{q}_{grnd,liq}`: section :numref:`Canopy Water`).

To conserve mass, irrigation is removed from river water storage (Chapter :numref:`rst_River Transport Model (RTM)`). When river water storage is inadequate to meet irrigation demand, there are two options: 1) the additional water can be removed from the ocean model, or 2) the irrigation demand can be reduced such that river water storage is maintained above a specified threshold.
To conserve mass, irrigation is removed from river water storage (Chapter :numref:`rst_MOSART`). When river water storage is inadequate to meet irrigation demand, there are two options: 1) the additional water can be removed from the ocean model, or 2) the irrigation demand can be reduced such that river water storage is maintained above a specified threshold.

.. _Table Irrigation parameters:

Expand Down
4 changes: 2 additions & 2 deletions doc/source/tech_note/Glacier/CLM50_Tech_Note_Glacier.rst
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,11 @@ The default behaviors for the world's glacier and ice sheet regions are describe

.. note::

It is possible to have non-virtual, non-SMB-computing areas within the CISM domain (as is the case for the portion of CISM's Greenland domain outside of Greenland itself). However, these areas will send 0 SMB and will not be able to adjust to CISM-dictated changes in glacier area. Therefore, it is best to set up the glacier regions and their behaviors so that as much of the CISM domain as possible is covered by virtual, SMB-computing areas.
It is possible to have non-virtual, non-SMB-computing areas within the CISM domain (as is the case for the portion of CISM's Greenland domain outside of Greenland itself). However, these areas will send 0 SMB and will not be able to adjust to CISM-dictated changes in glacier area. Therefore, it is best to set up the glacier regions and their behaviors so that as much of the CISM domain as possible is covered by virtual, SMB-computing areas.

.. note::

The combination of the ``Glacial melt = Replaced by ice`` and the ``Ice runoff = Melted`` behaviors results in particularly non-physical behavior: During periods of glacial melt, a negative ice runoff is generated (due to the ``Glacial melt = Replaced by ice`` behavior); this negative ice runoff is converted to a negative liquid runoff plus a positive sensible heat flux (due to the ``Ice runoff = Melted`` behavior). The net result is zero runoff but a positive sensible heat flux generated from glacial melt. Because of how physically unrealistic this is, CLM does not allow this combination of behaviors.
The combination of the ``Glacial melt = Replaced by ice`` and the ``Ice runoff = Melted`` behaviors results in particularly non-physical behavior: During periods of glacial melt, a negative ice runoff is generated (due to the ``Glacial melt = Replaced by ice`` behavior); this negative ice runoff is converted to a negative liquid runoff plus a positive sensible heat flux (due to the ``Ice runoff = Melted`` behavior). The net result is zero runoff but a positive sensible heat flux generated from glacial melt. Because of how physically unrealistic this is, CLM does not allow this combination of behaviors.

.. _Multiple elevation class scheme:

Expand Down
4 changes: 2 additions & 2 deletions doc/source/tech_note/Hydrology/CLM50_Tech_Note_Hydrology.rst
Original file line number Diff line number Diff line change
Expand Up @@ -923,7 +923,7 @@ Runoff from glaciers and snow-capped surfaces

All surfaces are constrained to have a snow water equivalent :math:`W_{sno} \le W_{cap} = 10,000` kg m\ :sup:`-2`. For snow-capped columns, any addition of mass at the top (precipitation, dew/riping) is balanced by an equally large mass flux at the bottom of the snow column. This so-called capping flux is separated into solid :math:`q_{snwcp,ice}` \ and liquid :math:`q_{snwcp,liq}` runoff terms. The partitioning of these phases is based on the phase ratio in the bottom snow layer at the time of the capping, such that phase ratio in this layer is unaltered.

The :math:`q_{snwcp,ice}` runoff is sent to the River Transport Model (RTM) (Chapter 11) where it is routed to the ocean as an ice stream and, if applicable, the ice is melted there.
The :math:`q_{snwcp,ice}` runoff is sent to MOSART (Chapter :numref:`rst_MOSART`) where it is routed to the ocean as an ice stream and, if applicable, the ice is melted there.

For snow-capped surfaces other than glaciers and lakes the :math:`q_{snwcp,liq}` runoff is assigned to the glaciers and lakes runoff term :math:`q_{rgwl}` (e.g. :math:`q_{rgwl} =q_{snwcp,liq}` ). For glacier surfaces the runoff term :math:`q_{rgwl}` is calculated from the residual of the water balance

Expand All @@ -939,4 +939,4 @@ where :math:`W_{b}^{n}` and :math:`W_{b}^{n+1}` are the water balances at the be

W_{b} =W_{can} +W_{sno} +\sum _{i=1}^{N}\left(w_{ice,i} +w_{liq,i} \right) .

Currently, glaciers are non-vegetated and :math:`E_{v} =W_{can} =0`. The contribution of lake runoff to :math:`q_{rgwl}` is described in section :numref:`Precipitation, Evaporation, and Runoff Lake`. The runoff term :math:`q_{rgwl}` may be negative for glaciers and lakes, which reduces the total amount of runoff available to the river routing model (Chapter :numref:`rst_River Transport Model (RTM)`).
Currently, glaciers are non-vegetated and :math:`E_{v} =W_{can} =0`. The contribution of lake runoff to :math:`q_{rgwl}` is described in section :numref:`Precipitation, Evaporation, and Runoff Lake`. The runoff term :math:`q_{rgwl}` may be negative for glaciers and lakes, which reduces the total amount of runoff available to the river routing model (Chapter :numref:`rst_MOSART`).
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ Biogeophysical and biogeochemical processes are simulated for each subgrid land

#. Glacier processes (Chapter :numref:`rst_Glaciers`)

#. River routing and river flow (Chapter :numref:`rst_River Transport Model (RTM)`)
#. River routing and river flow (Chapter :numref:`rst_MOSART`)

#. Urban energy balance and climate (Chapter :numref:`rst_Urban Model (CLMU)`)

Expand Down
10 changes: 5 additions & 5 deletions doc/source/tech_note/MOSART/CLM50_Tech_Note_MOSART.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.. _rst_River Transport Model (RTM):
.. _rst_MOSART:

Model for Scale Adaptive River Transport (MOSART)
=================================================
====================================================

.. _Overview MOSART:

Expand All @@ -21,9 +21,9 @@ MOSART divides each spatial unit such as a lat/lon grid or watershed into three

.. _Figure MOSART conceptual diagram:

.. figure:: mosart_diagram.png
:width: 800px
:height: 400px
.. Figure:: mosart_diagram.png

MOSART conceptual diagram

MOSART only routes positive runoff, although negative runoff can be generated occasionally by the land model (e.g., :math:`q_{gwl}`). Negative runoff in any runoff component including :math:`q_{sur}`, :math:`q_{sub}`, :math:`q_{gwl}` is not routed through MOSART, but instead is mapped directly from the spatial unit where it is generated at any time step to the coupler.

Expand Down
2 changes: 1 addition & 1 deletion doc/source/users_guide/overview/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Running the CLM requires a suite of UNIX utilities and programs and you should m
List of utilities required for CESM in the `Software/OS Prerequisites <https://www2.cesm.ucar.edu/models/cesm1.2/cesm/doc/usersguide/x32.html#software_system_prerequisites>`_ section of the CESM User's Guide.

- UNIX bash shell (for some of the CLM tools scripts)
- NCL (for some of the offline tools for creating/modifying CLM input datasets; see :ref:`using-ncl` for more information)
- NCL (for some of the offline tools for creating/modifying CLM input datasets)
- Python

Before working with |version| read the `CESM QuickStart Guide <https://escomp.github.io/CESM/versions/cesm2.2/html/>`_. Once you are familiar with how to setup cases for any type of simulation with CESM you will want to direct your attention to the specifics of using CLM.
Expand Down
Loading
Loading