Skip to content

Commit e96e09e

Browse files
authored
Merge pull request #552 from ekluzek/transcrop2rel
Move fix for transient non-crop to release-clm5.0 branch
2 parents 6d4e9d0 + c582625 commit e96e09e

19 files changed

+783
-108
lines changed

.CTSMTrunkChecklist

-58
This file was deleted.

CTSMMasterChecklist

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
Checklist of steps to do to make a CTSM Trunk Tag Oct/1st/2018
2+
3+
CTSM Software Management team.
4+
5+
See the wiki page for this on:
6+
7+
https://github.com/ESCOMP/ctsm/wiki/CTSM-development-workflow
8+
9+
(1) Update your branch to latest version of ESCOMP/ctsm master branch (git fetch followed
10+
by git merge)
11+
12+
(2) Make sure you have the latest version of code in your testing sandbox
13+
14+
2a -- run 'git pull' to pull in the latest version from GitHub
15+
2b -- run 'git status' and/or 'git diff' to make sure you don't have any uncommitted
16+
local changes
17+
2c -- run './manage_externals/checkout_externals -S' to make sure all externals are
18+
updated and don't have any uncommitted changes. (If any are marked with 's' in
19+
the first column, run ./manage_externals/checkout_externals to update them.)
20+
21+
(3) Do all testing on your fork/feature-branch
22+
23+
3a -- make sure any new failing tests are either fixed or approved as a new expected
24+
fail
25+
3b -- update the ExpectedFails list if expected fails changes in 1a
26+
$EDITOR cime_config/testdefs/ExpectedTestFails.xml
27+
3c -- make sure you understand any changes to the baselines -- to document in ChangeLog
28+
29+
(4) Use diff and status to make sure any new files are in the repo and only the correct
30+
changes are on the branch
31+
32+
4a -- 'git status' to check that you've added any new files and haven't
33+
added any non source files that aren't needed in the repository
34+
4b -- 'git diff' to check that your changes are correct and you didn't accidentally
35+
add something unintentionally
36+
37+
(5) Update ChangeLog
38+
39+
5a -- From the 'doc' directory, run './UpdateChangelog.pl TAGNAME "one-line summary"'.
40+
This will open an editor with the ChangeLog. You can edit it now (step 4b) or
41+
exit your editor and then reopen it manually.
42+
5b -- Fill in the ChangeLog entry
43+
5c -- Update date stamp on ChangeLog
44+
./UpDateChangeLog.pl -update
45+
5d -- Commit new change files
46+
47+
(6) Submit a pull request (PR) for the changes
48+
Have someone review it if you are able. At minimum review it youself. The PR mechanism
49+
on git is an excellent way to code review code for both yourself and others. Also make
50+
sure all your changes are correct, changes that shouldn't have gone in don't, and all new
51+
files are added in.
52+
53+
---- THE FOLLOWING CAN ONLY BE DONE BY INTEGRATORS ----
54+
55+
(7) Merge the PR to master when review is approved
56+
57+
(8) Compare master to branch show that they are identical
58+
59+
git diff master remote/feature-branch
60+
61+
This should show no diffs
62+
63+
(9) Make an annotated tag on master
64+
65+
(10) Push master and tag to ESCOMP/ctsm
66+
67+
---- NOTES ----
68+
69+
(3) -- Always test on your fork with a feature-branch so that we can change tag order if needed. Put
70+
baselines in the next tag name, as we can easily change afterwards if needed.
71+

bld/CLMBuildNamelist.pm

+22-6
Original file line numberDiff line numberDiff line change
@@ -1880,7 +1880,11 @@ sub setup_logic_irrigate {
18801880
if ( $physv->as_long() >= $physv->as_long("clm4_5") ) {
18811881
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'irrigate',
18821882
'use_crop'=>$nl_flags->{'use_crop'}, 'use_cndv'=>$nl_flags->{'use_cndv'} );
1883-
$nl_flags->{'irrigate'} = lc($nl->get_value('irrigate'));
1883+
if ( &value_is_true($nl->get_value('irrigate') ) ) {
1884+
$nl_flags->{'irrigate'} = ".true."
1885+
} else {
1886+
$nl_flags->{'irrigate'} = ".false."
1887+
}
18841888
}
18851889
}
18861890

@@ -2074,6 +2078,9 @@ sub setup_logic_create_crop_landunit {
20742078
if ( &value_is_true($nl_flags->{'use_fates'}) && &value_is_true($nl->get_value($var)) ) {
20752079
$log->fatal_error( "$var is true and yet use_fates is being set, which contradicts that (use_fates requires $var to be .false." );
20762080
}
2081+
if ( (! &value_is_true($nl_flags->{'use_fates'})) && (! &value_is_true($nl->get_value($var))) ) {
2082+
$log->fatal_error( "$var is false which is ONLY allowed when FATES is being used" );
2083+
}
20772084
}
20782085
}
20792086

@@ -2566,9 +2573,6 @@ sub setup_logic_do_transient_crops {
25662573
if (string_is_undef_or_empty($nl->get_value('flanduse_timeseries'))) {
25672574
$cannot_be_true = "$var can only be set to true when running a transient case (flanduse_timeseries non-blank)";
25682575
}
2569-
elsif (!&value_is_true($nl->get_value('use_crop'))) {
2570-
$cannot_be_true = "$var can only be set to true when running with use_crop = true";
2571-
}
25722576
elsif (&value_is_true($nl->get_value('use_fates'))) {
25732577
# In principle, use_fates should be compatible with
25742578
# do_transient_crops. However, this hasn't been tested, so to be safe,
@@ -2594,6 +2598,13 @@ sub setup_logic_do_transient_crops {
25942598
$log->fatal_error($cannot_be_true);
25952599
}
25962600

2601+
my $dopft = "do_transient_pfts";
2602+
# Make sure the value agrees with the do_transient_pft flag
2603+
if ( ( &value_is_true($nl->get_value($var))) && (! &value_is_true($nl->get_value($dopft))) ||
2604+
(! &value_is_true($nl->get_value($var))) && ( &value_is_true($nl->get_value($dopft))) ) {
2605+
$log->fatal_error("$var and $dopft do NOT agree and need to");
2606+
}
2607+
25972608
}
25982609
}
25992610

@@ -3047,9 +3058,12 @@ sub setup_logic_fertilizer {
30473058
my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_;
30483059

30493060
if ( $physv->as_long() >= $physv->as_long("clm4_5") ) {
3050-
$nl_flags->{'use_crop'} = $nl->get_value('use_crop');
30513061
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_fertilizer',
30523062
'use_crop'=>$nl_flags->{'use_crop'} );
3063+
my $use_fert = $nl->get_value('use_fertilizer');
3064+
if ( (! &value_is_true($nl_flags->{'use_crop'})) && &value_is_true($use_fert) ) {
3065+
$log->fatal_error("use_ferilizer can NOT be on without prognostic crop\n" );
3066+
}
30533067
}
30543068
}
30553069

@@ -3062,9 +3076,11 @@ sub setup_logic_grainproduct {
30623076
my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_;
30633077

30643078
if ( $physv->as_long() >= $physv->as_long("clm4_5") ) {
3065-
$nl_flags->{'use_crop'} = $nl->get_value('use_crop');
30663079
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_grainproduct',
30673080
'use_crop'=>$nl_flags->{'use_crop'}, 'phys'=>$physv->as_string() );
3081+
if ( (! &value_is_true($nl_flags->{'use_crop'})) && &value_is_true($nl->get_value('use_grainproduct') ) ) {
3082+
$log->fatal_error("use_grainproduct can NOT be on without prognostic crop\n" );
3083+
}
30683084
}
30693085
}
30703086

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#!/usr/bin/env python
2+
3+
import os, sys
4+
5+
class mksrfDataEntry_prog:
6+
7+
# Class data
8+
year_start = 2016
9+
year_end = 2100
10+
ssp_rcp = "SSP5-8.5"
11+
subdir = "pftcftdynharv.0.25x0.25.SSP5-8.5.simyr2016-2100.c171005"
12+
cdate = 171005
13+
desc = "SSP5RCP85_clm5"
14+
15+
def parse_cmdline_args( self ):
16+
"Parse the command line arguments for create data entry list"
17+
from optparse import OptionParser, OptionGroup
18+
19+
parser = OptionParser( usage="%prog [options]" )
20+
options = OptionGroup( parser, "Options" )
21+
options.add_option( "-s", "--year_start", dest="year_start", default=self.year_start, \
22+
help="Start year" )
23+
options.add_option( "-f", "--year_end", dest="year_end", default=self.year_end, \
24+
help="End year" )
25+
options.add_option( "-d", "--subdir", dest="subdir", default=self.subdir, \
26+
help="Subdirectory" )
27+
options.add_option( "--cdate", dest="cdate", default=self.cdate, \
28+
help="Creation date" )
29+
options.add_option( "--desc", dest="desc", default=self.desc, \
30+
help="Description string" )
31+
parser.add_option_group(options)
32+
(options, args) = parser.parse_args()
33+
if len(args) != 0:
34+
parser.error("incorrect number of arguments")
35+
36+
self.year_start = options.year_start
37+
self.year_end = options.year_end
38+
self.subdir = options.subdir
39+
self.cdate = options.cdate
40+
self.desc = options.desc
41+
42+
def printentry( self, year ):
43+
"Print a single entry"
44+
print '<mksrf_fvegtyp hgrid="0.25x0.25" ssp_rcp="%s" sim_year="%d" crop="on"' % (self.ssp_rcp, year)
45+
print '>lnd/clm2/rawdata/%s/mksrf_landuse_%s_%s.c%s.nc' % (self.subdir, self.desc, year, self.cdate)
46+
print '</mksrf_fvegtyp>\n'
47+
48+
entry = mksrfDataEntry_prog()
49+
entry.parse_cmdline_args()
50+
51+
for year in range(entry.year_start, entry.year_end+1):
52+
entry.printentry( year )
53+
54+
55+
56+

0 commit comments

Comments
 (0)