Skip to content

Commit 61a9816

Browse files
authored
Merge pull request #4749 from ESMCI/doc_update
- Updates PR/issue templates - Updates function doc strings - Updates README.md - Updates API docs generation to sphinx autosummary - Updates documentation organization into two main sections: `ccs` and `system testing`. - Updates documentation for model configuration - Updates documentation for XML variables - Adds documentation generation for XML schema - Adds documentation for node failure/mpi retry - Moves users_guide to ccs/ - Moves build_cpl to ccs/model-configuration/variables/component.rst - Moves misc_tools/ect.rst to tools/ect.rst - Moves what_cime to ccs/index.rst - Moves users_guide/testing.rst to system_testing.rst - Removes xml_files/, files no longer in CIME - Removes misc_tools/load-balancer-tool.rst, no longer in CIME
2 parents d0b2279 + c92d24e commit 61a9816

File tree

113 files changed

+6477
-5482
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

113 files changed

+6477
-5482
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
## What happened?
2+
<!--
3+
Thanks for reporting a bug!
4+
Please describe what you were trying to do, what happened, what went wrong.
5+
-->
6+
7+
## What did you expect to happen?
8+
<!--
9+
What did you expect to happen?
10+
-->
11+
12+
## Environment
13+
<!--
14+
Describe the environment the issue occurred in e.g. machine, module system, batch system, etc.
15+
-->
16+
17+
## Describe steps to recreate issue.
18+
<!--
19+
Describe the steps to recreate the issue.
20+
Provide as much detail as possible.
21+
-->
22+
23+
## Relevant logs
24+
<!--
25+
Include as many relevant logs.
26+
-->
27+
28+
## Anything else we need to know?
29+
<!--
30+
Is there anything else that could help?
31+
-->
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
## Describe the problem your experiencing
2+
<!--
3+
Please provide a clear and concise description of what the problem is e.g. I'm always frustrated when [...]
4+
-->
5+
6+
## Describe the solution you'd like
7+
<!--
8+
A clear and consise description of what you want to happen.
9+
-->
10+
11+
## Describe alternative solutions
12+
<!--
13+
A clear and concise description of any alternative solutions or features you've considered.
14+
-->
15+
16+
## Additional context
17+
<!--
18+
Add any other context about the feature request here.
19+
-->

.github/PULL_REQUEST_TEMPLATE

Lines changed: 0 additions & 16 deletions
This file was deleted.

.github/pull_request_template.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
## Description
2+
<!--
3+
Please include a summary of the change and which issues it fixed.
4+
Please also include relevant motivation and context.
5+
-->
6+
7+
- Closes #<ISSUE_NUMBER_HERE>
8+
9+
## Checklist
10+
- [ ] My code follows the style guidlines of this proejct (black formatting)
11+
- [ ] I have performed a self-review of my own code
12+
- [ ] My changes generate no new warnings
13+
- [ ] I have added tests that excerise my feature/fix and existing tests continue to pass
14+
- [ ] I have commented my code, particularly in hard-to-understand areas
15+
- [ ] I have made corresponding additions and changes to the documentation

.vscode/tasks.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22
"version": "2.0.0",
33
"tasks": [
44
{
5+
"label": "Build documentation",
6+
"type": "shell",
7+
"command": "source ${workspaceFolder}/.venv/bin/activate && sphinx-autobuild --ignore generated/ . _build/html",
8+
"options": {
9+
"cwd": "${workspaceFolder}/doc/source"
10+
}
11+
},
12+
{
513
"label": "Docker Build (base)",
614
"type": "shell",
715
"command": "docker build -t ghcr.io/esmci/cime:dev --target base .",

CIME/compare_test_results.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,15 @@
88

99
import os, logging
1010

11-
###############################################################################
11+
1212
def append_status_cprnc_log(msg, logfile_name, test_dir):
13-
###############################################################################
1413
try:
1514
append_status(msg, logfile_name, caseroot=test_dir)
1615
except IOError:
1716
pass
1817

1918

20-
###############################################################################
2119
def compare_namelists(case, baseline_name, baseline_root, logfile_name):
22-
###############################################################################
2320
log_lvl = logging.getLogger().getEffectiveLevel()
2421
logging.disable(logging.CRITICAL)
2522
success = case.case_cmpgen_namelists(
@@ -32,9 +29,7 @@ def compare_namelists(case, baseline_name, baseline_root, logfile_name):
3229
return success
3330

3431

35-
###############################################################################
3632
def compare_history(case, baseline_name, baseline_root, log_id):
37-
###############################################################################
3833
real_user = case.get_value("REALUSER")
3934
with EnvironmentContext(USER=real_user):
4035
baseline_full_dir = os.path.join(
@@ -54,7 +49,6 @@ def compare_history(case, baseline_name, baseline_root, log_id):
5449
return result, comments
5550

5651

57-
###############################################################################
5852
def compare_test_results(
5953
baseline_name,
6054
baseline_root,
@@ -65,18 +59,16 @@ def compare_test_results(
6559
namelists_only=False,
6660
hist_only=False,
6761
):
68-
###############################################################################
69-
"""
70-
Compares with baselines for all matching tests
62+
"""Compares with baselines for all matching tests
7163
7264
Outputs results for each test to stdout (one line per test); possible status
7365
codes are: PASS, FAIL, SKIP. (A SKIP denotes a test that did not make it to
7466
the run phase or a test for which the run phase did not pass: we skip
7567
baseline comparisons in this case.)
7668
7769
In addition, creates files named compare.log.BASELINE_NAME.TIMESTAMP in each
78-
test directory, which contain more detailed output. Also creates
79-
*.cprnc.out.BASELINE_NAME.TIMESTAMP files in each run directory.
70+
test directory, which contain more detailed output. Also creates "*.cprnc.out.BASELINE_NAME.TIMESTAMP
71+
files in each run directory.
8072
8173
Returns True if all tests generated either PASS or SKIP results, False if
8274
there was at least one FAIL result.

CIME/cs_status_creator.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,18 @@ def create_cs_status(test_root, test_id, extra_args="", filename=None):
1212
"""Create a test suite-specific cs.status file from the template
1313
1414
Arguments:
15-
test_root (string): path to test root; the file will be put here. If
16-
this directory doesn't exist, it is created.
17-
test_id (string): test id for this test suite. This can contain
18-
shell wildcards if you want this one cs.status file to work
19-
across multiple test suites. However, be careful not to make
20-
this too general: for example, ending this with '*' will pick up
21-
the *.ref1 directories for ERI and other tests, which is NOT
22-
what you want.
23-
extra_args (string): extra arguments to the cs.status command
24-
(If there are multiple arguments, these should be in a space-delimited string.)
25-
filename (string): name of the generated cs.status file. If not
26-
given, this will be built from the test_id.
15+
test_root (string): path to test root; the file will be put here. If
16+
this directory doesn't exist, it is created.
17+
test_id (string): test id for this test suite. This can contain
18+
shell wildcards if you want this one cs.status file to work
19+
across multiple test suites. However, be careful not to make
20+
this too general: for example, ending this with '*' will pick up
21+
the *.ref1 directories for ERI and other tests, which is NOT
22+
what you want.
23+
extra_args (string): extra arguments to the cs.status command
24+
(If there are multiple arguments, these should be in a space-delimited string.)
25+
filename (string): name of the generated cs.status file. If not
26+
given, this will be built from the test_id.
2727
"""
2828
cime_root = CIME.utils.get_cime_root()
2929
tools_path = os.path.join(cime_root, "CIME", "Tools")

CIME/hist_utils.py

Lines changed: 46 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,14 @@ def copy_histfiles(case, suffix, match_suffix=None):
6565
This can allow you to temporarily "save" these files so they won't be blown
6666
away if you re-run the case.
6767
68-
case - The case containing the files you want to save
69-
suffix - The string suffix you want to add to saved files, this can be used to find them later.
70-
71-
returns (comments, num_copied)
68+
Args:
69+
case (CIME.case.Case): The case containing the files you want to save
70+
suffix (str): The string suffix you want to add to saved files, this can be used to find them later.
71+
72+
Returns:
73+
Tuple str, int: (comments, num_copied)
74+
comments is a string containing the comments generated by this function
75+
num_copied is the number of files copied
7276
"""
7377
rundir = case.get_value("RUNDIR")
7478
ref_case = case.get_value("RUN_REFCASE")
@@ -411,18 +415,22 @@ def _compare_hists(
411415

412416

413417
def compare_test(case, suffix1, suffix2, ignore_fieldlist_diffs=False):
414-
"""
415-
Compares two sets of component history files in the testcase directory
418+
"""Compares two sets of component history files in the testcase directory
416419
417-
case - The case containing the hist files to compare
418-
suffix1 - The suffix that identifies the first batch of hist files
419-
suffix1 - The suffix that identifies the second batch of hist files
420-
ignore_fieldlist_diffs (bool): If True, then: If the two cases differ only in their
420+
Args:
421+
case (CIME.case.Case): The case containing the hist files to compare
422+
suffix1 (str): The suffix that identifies the first batch of hist files
423+
suffix2 (str): The suffix that identifies the second batch of hist files
424+
ignore_fieldlist_diffs (bool): If True, then: If the two cases differ only in their
421425
field lists (i.e., all shared fields are bit-for-bit, but one case has some
422426
diagnostic fields that are missing from the other case), treat the two cases as
423427
identical.
424428
425-
returns (SUCCESS, comments, num_compared)
429+
Returns:
430+
Tuple bool, str, str: (files_match, output_filename, comment)
431+
files_match is True if the files matched, False otherwise.
432+
output_filename is the name of the cprnc output file or None if outfile_suffix is None.
433+
comment is either an empty string or one of the module-level constants beginning with CPRNC (e.g., CPRNC_FIELDLISTS_DIFFER)
426434
"""
427435
rundir = case.get_value("RUNDIR")
428436

@@ -447,24 +455,27 @@ def cprnc(
447455
ignore_fieldlist_diffs=False,
448456
cprnc_exe=None,
449457
):
450-
"""
451-
Run cprnc to compare two individual nc files
452-
453-
file1 - the full or relative path of the first file
454-
file2 - the full or relative path of the second file
455-
case - the case containing the files
456-
rundir - the rundir for the case
457-
outfile_suffix - if non-blank, then the output file name ends with this
458-
suffix (with a '.' added before the given suffix).
459-
Use None to avoid permissions issues in the case dir.
460-
ignore_fieldlist_diffs (bool): If True, then: If the two cases differ only in their
461-
field lists (i.e., all shared fields are bit-for-bit, but one case has some
462-
diagnostic fields that are missing from the other case), treat the two cases as
463-
identical.
458+
"""Run the cprnc tool to compare two individual netcdf files.
459+
460+
Args:
461+
file1 (str): The full or relative path of the first file.
462+
file2 (str): The full or relative path of the second file.
463+
case (CIME.case.Case): the case containing the files.
464+
rundir (str): The rundir for the case
465+
outfile_suffix (str): If non-blank, then the output file name ends with this
466+
suffix (with a '.' added before the given suffix). Use None to avoid
467+
permissions issues in the case dir.
468+
ignore_fieldlist_diffs (bool): If True, then: If the two cases differ only in
469+
their field lists (i.e., all shared fields are bit-for-bit, but one case has
470+
some diagnostic fields that are missing from the other case), treat the two
471+
cases as identical.
472+
473+
Returns:
474+
Tuple bool, str, str: (files_match, output_filename, comment)
475+
files_match is True if the files matched, False otherwise.
476+
output_filename is the name of the cprnc output file or None if outfile_suffix is None.
477+
comment is either an empty string or one of the module-level constants beginning with CPRNC (e.g., CPRNC_FIELDLISTS_DIFFER)
464478
465-
returns (True if the files matched, log_name, comment)
466-
where 'comment' is either an empty string or one of the module-level constants
467-
beginning with CPRNC_ (e.g., CPRNC_FIELDLISTS_DIFFER)
468479
"""
469480
if not cprnc_exe:
470481
cprnc_exe = case.get_value("CCSM_CPRNC")
@@ -548,16 +559,15 @@ def cprnc(
548559

549560

550561
def compare_baseline(case, baseline_dir=None, outfile_suffix=""):
551-
"""
552-
compare the current test output to a baseline result
562+
"""Compare the current test output to a baseline result
553563
554-
case - The case containing the hist files to be compared against baselines
555-
baseline_dir - Optionally, specify a specific baseline dir, otherwise it will be computed from case config
556-
outfile_suffix - if non-blank, then the cprnc output file name ends with
557-
this suffix (with a '.' added before the given suffix). if None, no output file saved.
564+
Args:
565+
case - The case containing the hist files to be compared against baselines
566+
baseline_dir - Optionally, specify a specific baseline dir, otherwise it will be computed from case config
567+
outfile_suffix - if non-blank, then the cprnc output file name ends with this suffix (with a '.' added before the given suffix). if None, no output file saved.
558568
559-
returns (SUCCESS, comments)
560-
SUCCESS means all hist files matched their corresponding baseline
569+
Returns:
570+
Tuple bool, str: (success, comments). Success means all hist files matched their corresponding baseline.
561571
"""
562572
rundir = case.get_value("RUNDIR")
563573
if baseline_dir is None:

CIME/namelist.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""Module containing tools for dealing with Fortran namelists.
22
33
The public interface consists of the following functions:
4+
45
- `character_literal_to_string`
56
- `compress_literal_list`
67
- `expand_literal_list`
@@ -62,6 +63,7 @@
6263
The Fortran standard only applies to the interior of namelist groups, and not to
6364
text between one namelist group and the next. This module assumes that namelist
6465
groups are separated by (optional) whitespace and comments, and nothing else.
66+
6567
"""
6668

6769
###############################################################################
@@ -840,18 +842,18 @@ def parse(in_file=None, text=None, groupless=False, convert_tab_to_space=True):
840842
The `groupless` argument changes namelist parsing in two ways:
841843
842844
1. `parse` allows an alternate file format where no group names or slashes
843-
are present. In effect, the file is parsed as if an invisible, arbitrary
844-
group name was prepended, and an invisible slash was appended. However,
845-
if any group names actually are present, the file is parsed normally.
845+
are present. In effect, the file is parsed as if an invisible, arbitrary
846+
group name was prepended, and an invisible slash was appended. However,
847+
if any group names actually are present, the file is parsed normally.
846848
2. The return value of this function is not a `Namelist` object. Instead a
847-
single, flattened dictionary of name-value pairs is returned.
849+
single, flattened dictionary of name-value pairs is returned.
848850
849851
The `convert_tab_to_space` option can be used to force all tabs in the file
850852
to be converted to spaces, and is on by default. Note that this will usually
851853
allow files that use tabs as whitespace to be parsed. However, the
852854
implementation of this option is crude; it converts *all* tabs in the file,
853855
including those in character literals. (Note that there are many characters
854-
that cannot be passed in via namelist in any standard way, including '\n',
856+
that cannot be passed in via namelist in any standard way, including '\\n',
855857
so it is already a bad idea to assume that the namelist will preserve
856858
whitespace in strings, aside from simple spaces.)
857859
@@ -860,6 +862,7 @@ def parse(in_file=None, text=None, groupless=False, convert_tab_to_space=True):
860862
All names and values returned are ultimately unicode strings. E.g. a value
861863
of "6*2" is returned as that string; it is not converted to 6 copies of the
862864
Python integer `2`. Null values are returned as the empty string ("").
865+
863866
"""
864867
expect(
865868
in_file is not None or text is not None,

0 commit comments

Comments
 (0)