Skip to content

Commit

Permalink
Merge pull request #552 from ekluzek/transcrop2rel
Browse files Browse the repository at this point in the history
Move fix for transient non-crop to release-clm5.0 branch
  • Loading branch information
ekluzek authored Oct 30, 2018
2 parents 6d4e9d0 + c582625 commit e96e09e
Show file tree
Hide file tree
Showing 19 changed files with 783 additions and 108 deletions.
58 changes: 0 additions & 58 deletions .CTSMTrunkChecklist

This file was deleted.

71 changes: 71 additions & 0 deletions CTSMMasterChecklist
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
Checklist of steps to do to make a CTSM Trunk Tag Oct/1st/2018

CTSM Software Management team.

See the wiki page for this on:

https://github.com/ESCOMP/ctsm/wiki/CTSM-development-workflow

(1) Update your branch to latest version of ESCOMP/ctsm master branch (git fetch followed
by git merge)

(2) Make sure you have the latest version of code in your testing sandbox

2a -- run 'git pull' to pull in the latest version from GitHub
2b -- run 'git status' and/or 'git diff' to make sure you don't have any uncommitted
local changes
2c -- run './manage_externals/checkout_externals -S' to make sure all externals are
updated and don't have any uncommitted changes. (If any are marked with 's' in
the first column, run ./manage_externals/checkout_externals to update them.)

(3) Do all testing on your fork/feature-branch

3a -- make sure any new failing tests are either fixed or approved as a new expected
fail
3b -- update the ExpectedFails list if expected fails changes in 1a
$EDITOR cime_config/testdefs/ExpectedTestFails.xml
3c -- make sure you understand any changes to the baselines -- to document in ChangeLog

(4) Use diff and status to make sure any new files are in the repo and only the correct
changes are on the branch

4a -- 'git status' to check that you've added any new files and haven't
added any non source files that aren't needed in the repository
4b -- 'git diff' to check that your changes are correct and you didn't accidentally
add something unintentionally

(5) Update ChangeLog

5a -- From the 'doc' directory, run './UpdateChangelog.pl TAGNAME "one-line summary"'.
This will open an editor with the ChangeLog. You can edit it now (step 4b) or
exit your editor and then reopen it manually.
5b -- Fill in the ChangeLog entry
5c -- Update date stamp on ChangeLog
./UpDateChangeLog.pl -update
5d -- Commit new change files

(6) Submit a pull request (PR) for the changes
Have someone review it if you are able. At minimum review it youself. The PR mechanism
on git is an excellent way to code review code for both yourself and others. Also make
sure all your changes are correct, changes that shouldn't have gone in don't, and all new
files are added in.

---- THE FOLLOWING CAN ONLY BE DONE BY INTEGRATORS ----

(7) Merge the PR to master when review is approved

(8) Compare master to branch show that they are identical

git diff master remote/feature-branch

This should show no diffs

(9) Make an annotated tag on master

(10) Push master and tag to ESCOMP/ctsm

---- NOTES ----

(3) -- Always test on your fork with a feature-branch so that we can change tag order if needed. Put
baselines in the next tag name, as we can easily change afterwards if needed.

28 changes: 22 additions & 6 deletions bld/CLMBuildNamelist.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1880,7 +1880,11 @@ sub setup_logic_irrigate {
if ( $physv->as_long() >= $physv->as_long("clm4_5") ) {
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'irrigate',
'use_crop'=>$nl_flags->{'use_crop'}, 'use_cndv'=>$nl_flags->{'use_cndv'} );
$nl_flags->{'irrigate'} = lc($nl->get_value('irrigate'));
if ( &value_is_true($nl->get_value('irrigate') ) ) {
$nl_flags->{'irrigate'} = ".true."
} else {
$nl_flags->{'irrigate'} = ".false."
}
}
}

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

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

my $dopft = "do_transient_pfts";
# Make sure the value agrees with the do_transient_pft flag
if ( ( &value_is_true($nl->get_value($var))) && (! &value_is_true($nl->get_value($dopft))) ||
(! &value_is_true($nl->get_value($var))) && ( &value_is_true($nl->get_value($dopft))) ) {
$log->fatal_error("$var and $dopft do NOT agree and need to");
}

}
}

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

if ( $physv->as_long() >= $physv->as_long("clm4_5") ) {
$nl_flags->{'use_crop'} = $nl->get_value('use_crop');
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_fertilizer',
'use_crop'=>$nl_flags->{'use_crop'} );
my $use_fert = $nl->get_value('use_fertilizer');
if ( (! &value_is_true($nl_flags->{'use_crop'})) && &value_is_true($use_fert) ) {
$log->fatal_error("use_ferilizer can NOT be on without prognostic crop\n" );
}
}
}

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

if ( $physv->as_long() >= $physv->as_long("clm4_5") ) {
$nl_flags->{'use_crop'} = $nl->get_value('use_crop');
add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_grainproduct',
'use_crop'=>$nl_flags->{'use_crop'}, 'phys'=>$physv->as_string() );
if ( (! &value_is_true($nl_flags->{'use_crop'})) && &value_is_true($nl->get_value('use_grainproduct') ) ) {
$log->fatal_error("use_grainproduct can NOT be on without prognostic crop\n" );
}
}
}

Expand Down
56 changes: 56 additions & 0 deletions bld/namelist_files/createMkSrfEntry.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/usr/bin/env python

import os, sys

class mksrfDataEntry_prog:

# Class data
year_start = 2016
year_end = 2100
ssp_rcp = "SSP5-8.5"
subdir = "pftcftdynharv.0.25x0.25.SSP5-8.5.simyr2016-2100.c171005"
cdate = 171005
desc = "SSP5RCP85_clm5"

def parse_cmdline_args( self ):
"Parse the command line arguments for create data entry list"
from optparse import OptionParser, OptionGroup

parser = OptionParser( usage="%prog [options]" )
options = OptionGroup( parser, "Options" )
options.add_option( "-s", "--year_start", dest="year_start", default=self.year_start, \
help="Start year" )
options.add_option( "-f", "--year_end", dest="year_end", default=self.year_end, \
help="End year" )
options.add_option( "-d", "--subdir", dest="subdir", default=self.subdir, \
help="Subdirectory" )
options.add_option( "--cdate", dest="cdate", default=self.cdate, \
help="Creation date" )
options.add_option( "--desc", dest="desc", default=self.desc, \
help="Description string" )
parser.add_option_group(options)
(options, args) = parser.parse_args()
if len(args) != 0:
parser.error("incorrect number of arguments")

self.year_start = options.year_start
self.year_end = options.year_end
self.subdir = options.subdir
self.cdate = options.cdate
self.desc = options.desc

def printentry( self, year ):
"Print a single entry"
print '<mksrf_fvegtyp hgrid="0.25x0.25" ssp_rcp="%s" sim_year="%d" crop="on"' % (self.ssp_rcp, year)
print '>lnd/clm2/rawdata/%s/mksrf_landuse_%s_%s.c%s.nc' % (self.subdir, self.desc, year, self.cdate)
print '</mksrf_fvegtyp>\n'

entry = mksrfDataEntry_prog()
entry.parse_cmdline_args()

for year in range(entry.year_start, entry.year_end+1):
entry.printentry( year )




Loading

0 comments on commit e96e09e

Please sign in to comment.