diff --git a/components/data_comps/dice/bld/build-namelist b/components/data_comps/dice/bld/build-namelist
index 9abf6cca743..faa1dab5fda 100755
--- a/components/data_comps/dice/bld/build-namelist
+++ b/components/data_comps/dice/bld/build-namelist
@@ -306,6 +306,9 @@ if (defined $opts{'infile'}) {
my %xmlvars = ();
SetupTools::getxmlvars(${CASEROOT},\%xmlvars);
+# need to expand DIN_LOC_ROOT first
+$xmlvars{DIN_LOC_ROOT}=SetupTools::expand_xml_var($xmlvars{DIN_LOC_ROOT}, \%xmlvars);
+
foreach my $attr (keys %xmlvars) {
$xmlvars{$attr} = SetupTools::expand_xml_var($xmlvars{$attr}, \%xmlvars);
}
diff --git a/driver_cpl/cime_config/config_component.xml b/driver_cpl/cime_config/config_component.xml
index cf4881ddda8..7abe633670c 100644
--- a/driver_cpl/cime_config/config_component.xml
+++ b/driver_cpl/cime_config/config_component.xml
@@ -1146,14 +1146,6 @@
number of wav cells in j direction - DO NOT EDIT (for experts only)
-
- char
- UNSET
- build_grid
- env_build.xml
- grid mask - DO NOT EDIT (for experts only)
-
-
logical
TRUE,FALSE
@@ -1766,14 +1758,6 @@
Machine name
-
- char
-
- case_def
- env_case.xml
- full pathname of file specifying supported machines location
-
-
char
diff --git a/scripts/create_newcase b/scripts/create_newcase
index dee0026c657..bba9d90de5d 100755
--- a/scripts/create_newcase
+++ b/scripts/create_newcase
@@ -154,9 +154,9 @@ def _main_func():
with Case(caseroot, read_only=False) as case:
# Set values for env_case.xml
- case.set_value("CASE", os.path.basename(caseroot))
- case.set_value("CASEROOT", caseroot)
- case.set_value("SRCROOT", srcroot)
+ case.set_lookup_value("CASE", os.path.basename(caseroot))
+ case.set_lookup_value("CASEROOT", caseroot)
+ case.set_lookup_value("SRCROOT", srcroot)
# Configure the Case
case.configure(compset, grid, machine_name=machine, project=project,
diff --git a/utils/perl5lib/Streams/TemplateGeneric.pm b/utils/perl5lib/Streams/TemplateGeneric.pm
index 0e726177c3a..5c0d5858dcd 100644
--- a/utils/perl5lib/Streams/TemplateGeneric.pm
+++ b/utils/perl5lib/Streams/TemplateGeneric.pm
@@ -425,7 +425,9 @@ sub GetDataFilenames {
#
# Get path
#
+
my $filepath = $self->GetDataFilepath( $type );
+
my $key = "fileNames";
my $info;
if ( $type eq "data" ) {
@@ -463,8 +465,8 @@ sub GetDataFilepath {
if ( ! defined($self->{'template'}) ) {
die "${nm}:: a template has NOT been read in yet -- abort.\n";
}
- my $defaults_ref = $self->{'defaults'};
- my %defaults = %$defaults_ref;
+ my %defaults = %{$self->{'defaults'}};
+
my $key;
if ( $type eq "data" ) {
$key = "fieldInfo";
@@ -473,13 +475,14 @@ sub GetDataFilepath {
} else {
die "${nm}:: bad input type to method: $type should be data or domain\n";
}
+
my $Info_ref = $defaults{$key};
+
if ( ref($Info_ref) ne "HASH" ) {
die "${nm}:: $key is NOT a hash -- something must have went wrong in the Read\n";
}
- my %Info = %$Info_ref;
- my $filepath = $self->__Sub__( $Info_ref, 'filePath');
+ my $filepath = $self->__Sub__( $Info_ref, 'filePath');
return( $filepath );
}
@@ -490,7 +493,6 @@ sub expandXMLVar {
my $value = shift;
my $varhash_ref = shift;
my $nm = "expandXMLVar";
-
if ( ! defined($value) ) {
die "${nm}:: a value was NOT input\n";
}
@@ -559,6 +561,7 @@ sub __Sub__ {
my $lastmonth = $opts{'lastmonth'};
my $value = $$Info_ref{$name};
+
$value =~ s/^[ \n]+//; # remove leading spaces
$value =~ s/[ \n]+$//; # remove ending spaces
diff --git a/utils/python/CIME/XML/machines.py b/utils/python/CIME/XML/machines.py
index 5c861ca1311..8b83c9d6f61 100644
--- a/utils/python/CIME/XML/machines.py
+++ b/utils/python/CIME/XML/machines.py
@@ -27,9 +27,9 @@ def __init__(self, infile=None, files=None, machine=None):
if infile is None:
if files is None:
files = Files()
- infile = files.get_value("MACHINES_SPEC_FILE")
+ infile = files.get_value("MACHINES_SPEC_FILE", resolved=False)
self.machines_dir = os.path.dirname(infile)
-
+ infile = files.get_resolved_value(infile)
GenericXML.__init__(self, infile)
# Append the contents of $HOME/.cime/config_machines.xml if it exists
@@ -340,7 +340,7 @@ def get_full_mpirun(self, check_members, case, job):
batch_system = self.get_value("BATCH_SYSTEM")
if batch_system == "cobalt":
mpi_arg_string += " : "
-
+
return "%s %s %s" % (executable if executable is not None else "", mpi_arg_string, default_run_suffix)
def print_values(self):
diff --git a/utils/python/CIME/buildnml.py b/utils/python/CIME/buildnml.py
index 80ad886d9a7..ec0e8b09652 100644
--- a/utils/python/CIME/buildnml.py
+++ b/utils/python/CIME/buildnml.py
@@ -154,7 +154,9 @@ def _build_data_nml(case, caseroot, compclass):
rc, out, err = run_cmd(cmd, from_dir=confdir)
expect(rc==0,"Command %s failed rc=%d\nout=%s\nerr=%s"%(cmd,rc,out,err))
-
+ if out is not None:
+ logger.debug("cmd=%s"%cmd)
+ logger.info("out = %s"%out)
# copy namelist files and stream text files, to rundir
if os.path.isdir(rundir):
filename = compname + "_in"
diff --git a/utils/python/CIME/case.py b/utils/python/CIME/case.py
index 0ed270cd38d..e4bcae10c58 100644
--- a/utils/python/CIME/case.py
+++ b/utils/python/CIME/case.py
@@ -80,10 +80,9 @@ def __init__(self, case_root=None, read_only=True):
# for xml files that haven't been created yet. We need a place
# to store them until we are ready to create the file. At file
# creation we get the values for those fields from this lookup
- # table and then remove the entry. This was what I came up
- # with in the perl anyway and I think that we still need it here.
+ # table and then remove the entry.
self.lookups = {}
- self.lookups['CIMEROOT'] = os.path.abspath(get_cime_root())
+ self.set_lookup_value('CIMEROOT',os.path.abspath(get_cime_root()))
self._compsetname = None
self._gridname = None
@@ -91,7 +90,6 @@ def __init__(self, case_root=None, read_only=True):
self._pesfile = None
self._gridfile = None
self._components = []
- self._component_config_files = []
self._component_classes = []
# Define __enter__ and __exit__ so that we can use this as a context manager
@@ -286,11 +284,12 @@ def set_value(self, item, value, subgroup=None, ignore_type=False):
logger.debug("Will rewrite file %s %s",env_file.filename, item)
self._env_files_that_need_rewrite.add(env_file)
return result
- if result is None:
- if item in self.lookups.keys() and self.lookups[item] is not None:
- logger.warn("Item %s already in lookups with value %s"%(item,self.lookups[item]))
- else:
- self.lookups[item] = value
+
+ def set_lookup_value(self, item, value):
+ if item in self.lookups.keys() and self.lookups[item] is not None:
+ logger.warn("Item %s already in lookups with value %s"%(item,self.lookups[item]))
+ else:
+ self.lookups[item] = value
def _set_compset_and_pesfile(self, compset_name, user_compset=False, pesfile=None):
@@ -384,6 +383,10 @@ def _get_component_config_data(self):
# Determine list of component classes that this coupler/driver knows how
# to deal with. This list follows the same order as compset longnames follow.
files = Files()
+ # Add the group and elements for the config_files.xml
+ for env_file in self._env_entryid_files:
+ env_file.add_elements_by_group(files, attlist)
+
drv_config_file = files.get_value("CONFIG_DRV_FILE")
drv_comp = Component(drv_config_file)
for env_file in self._env_entryid_files:
@@ -399,16 +402,15 @@ def _get_component_config_data(self):
comp_class = self._component_classes[i]
comp_name = self._components[i-1]
node_name = 'CONFIG_' + comp_class + '_FILE'
- comp_config_file = files.get_value(node_name, {"component":comp_name}, resolved=True)
+ # Add the group and elements for the config_files.xml
+ comp_config_file = files.get_value(node_name, {"component":comp_name}, resolved=False)
+ self.set_value(node_name, comp_config_file)
+ comp_config_file = self.get_resolved_value(comp_config_file)
expect(comp_config_file is not None,"No config file for component %s"%comp_name)
compobj = Component(comp_config_file)
for env_file in self._env_entryid_files:
env_file.add_elements_by_group(compobj, attributes=attlist)
- self._component_config_files.append((node_name,comp_config_file))
- # Add the group and elements for the config_files.xml
- for env_file in self._env_entryid_files:
- env_file.add_elements_by_group(files, attlist)
for key,value in self.lookups.items():
result = self.set_value(key,value)
@@ -462,10 +464,11 @@ def configure(self, compset_name, grid_name, machine_name=None,
grids = Grids(gridfile)
gridinfo = grids.get_grid_info(name=grid_name, compset=self._compsetname)
+
self._gridname = gridinfo["GRID"]
for key,value in gridinfo.items():
logger.debug("Set grid %s %s"%(key,value))
- self.set_value(key,value)
+ self.set_lookup_value(key,value)
#--------------------------------------------
# component config data
@@ -474,10 +477,6 @@ def configure(self, compset_name, grid_name, machine_name=None,
self.get_compset_var_settings()
- # Add the group and elements for the config_files.xml
- for config_file in self._component_config_files:
- self.set_value(config_file[0],config_file[1])
-
#--------------------------------------------
# machine
#--------------------------------------------
@@ -831,11 +830,13 @@ def create_clone(self, newcase, keepexe=False, mach_dir=None, project=None):
if newcase_cimeroot != clone_cimeroot:
logger.warning(" case CIMEROOT is %s " %newcase_cimeroot)
logger.warning(" clone CIMEROOT is %s " %clone_cimeroot)
- logger.warning(" It is NOT recommended to clone cases from different versions of CIMEROOT")
+ logger.warning(" It is NOT recommended to clone cases from different versions of CIME.")
+
# *** create case object as deepcopy of clone object ***
srcroot = os.path.join(newcase_cimeroot,"..")
newcase = self.copy(newcasename, newcaseroot, newsrcroot=srcroot)
+ newcase.set_value("CIMEROOT", newcase_cimeroot)
# determine if will use clone executable or not
if keepexe: