Skip to content

Commit

Permalink
fix issue with resolving DIN_LOC_ROOT in perl
Browse files Browse the repository at this point in the history
  • Loading branch information
jedwards4b committed Aug 13, 2016
1 parent 90422ae commit 73a0e45
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions driver_cpl/bld/build-namelist
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ OPTIONS
NOTE: The precedence for setting the values of namelist variables is (highest to lowest):
1. values read from the file specified by -infile,
2. values from the namelist defaults file
2. values from the namelist defaults file
EOF
}

Expand Down Expand Up @@ -192,7 +192,7 @@ EOF
(-f "$perl5lib_dir/Build/Namelist.pm") or die <<"EOF";
** $ProgName - Cannot find perl module \"Build/Namelist.pm\" in directory \"$perl5lib_dir\" **
EOF
my @nl_definition_filenames = ( "namelist_definition_drv.xml",
my @nl_definition_filenames = ( "namelist_definition_drv.xml",
"namelist_definition_drv_flds.xml",
"namelist_definition_modio.xml" );
my @nl_definition_paths;
Expand Down Expand Up @@ -287,14 +287,11 @@ foreach my $file (@files) {
my @e = $xml->elements_by_name('entry');
while ( my $e = shift @e ) {
my %a = $e->get_attributes();
my $val = $a{value};
$xmlvars{$a{'id'}} = $a{'value'};
}
}
my $DIN_LOC_ROOT = $xmlvars{'DIN_LOC_ROOT'};
if ($print>=2) { print "inputdata root directory: $DIN_LOC_ROOT$eol"; }

# Note - $USER is not in the config_defintion.xml file - it is only in the environment
$xmlvars{'USER'} = $ENV{'USER'};
unshift @INC, "${CIMEROOT}/utils/perl5lib";
require Config::SetupTools;

Expand All @@ -304,6 +301,9 @@ foreach my $attr (keys %xmlvars) {
$xmlvars{$attr} = SetupTools::expand_xml_var($xmlvars{$attr}, \%xmlvars);
}

my $DIN_LOC_ROOT = $xmlvars{'DIN_LOC_ROOT'};
if ($print>=2) { print "inputdata root directory: $DIN_LOC_ROOT$eol"; }

#-----------------------------------------------------------------------------------------------
# Read in versions fo the drv_flds_in file from different components and merge them together
# Abort if there is a conflict
Expand All @@ -324,14 +324,14 @@ foreach my $fldsin ( @fldsinfiles ) {
if ($@) {
die "$ProgName - ERROR: Invalid namelist variable in '-infile' $opts{'infile'}.\n $@";
}

# Merge input values into namelist. Die if a conflict is found.
$nl->merge_nl($nl_infile_valid, die_on_conflict=>1);
}
}

#-----------------------------------------------------------------------------------------------
# Determine drv namelist
# Determine drv namelist
#-----------------------------------------------------------------------------------------------

#############################################
Expand Down Expand Up @@ -882,7 +882,7 @@ $definition->validate($nl);
# (1) Write output namelist files (drv_in, and drv_flds_in)
#-----------------------------------------------------------------------------------------------

# Write out drv_in namelist groups
# Write out drv_in namelist groups
my @groups = qw(seq_cplflds_inparm
seq_cplflds_userspec
seq_infodata_inparm
Expand All @@ -901,7 +901,7 @@ if ($print>=2) { print "Writing driver namelist to $outfile $eol"; }
my $outfile = "./drv_flds_in";
$nl->write($outfile, 'groups'=>\@groups);
if ($print>=2) { print "Writing driver fields namelist to $outfile $eol"; }

#-----------------------------------------------------------------------------------------------
# (2) Write out seq_map.rc file
#-----------------------------------------------------------------------------------------------
Expand All @@ -925,7 +925,7 @@ print $fh <<"EOF";
# if necessary
#
# NOTE: For bfb on different processor counts, set all maptypes to "X".
##################################################################
##################################################################
EOF
$fh->close();

Expand Down

0 comments on commit 73a0e45

Please sign in to comment.