Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/scripts/create_newcase b/scripts/create_newcase
- index 3d42145..601b083 100755
- --- a/scripts/create_newcase
- +++ b/scripts/create_newcase
- @@ -14,6 +14,7 @@ use English;
- use Getopt::Long;
- use IO::File;
- use IO::Handle;
- +use Data::Dumper;
- # Check for the existence of XML::LibXML in whatever perl distribution happens to be in use.
- # If not found, print a warning message then exit.
- @@ -74,64 +75,68 @@ my $machdir="$cfgdir/ccsm_utils/Machines";
- sub usage {
- die <<EOF;
- - SYNOPSIS
- - create_newcase [options]
- - OPTIONS
- - User supplied values are denoted in angle brackets (<>). Any value that contains
- - white-space must be quoted. Long option names may be supplied with either single
- - or double leading dashes. A consequence of this is that single letter options may
- - NOT be bundled.
- -
- - -case <name> Specifies the case name (required).
- - -compset <name> Specify a CESM compset (required).
- - -res <name> Specify a CESM grid resolution (required).
- - -mach <name> Specify a CESM machine (required).
- - -compiler <name> Specify a compiler for the target machine (optional)
- - default: default compiler for the target machine
- - -mpilib <name> Specify a mpi library for the target machine (optional)
- - default: default mpi library for the target machine
- - allowed: openmpi, mpich, ibm, mpi-serial, etc
- - redundant with _M confopts setting
- - -mach_dir <path> Specify the locations of the Machines directory (optional).
- - default: $machdir
- - -user_mods_dir <path>Path to directory with user_nl_* files and xmlchange_cmnds to use (optional).
- - -confopts <value> Specify some addition configuration options (optional)
- - _AOA = aoflux on atm grid
- - _AOE = aoflux on exch grid
- - _CG = gregorian calendar
- - _D = debug
- - _E = esmf interfaces
- - _IOP*= PnetCDF IO test where * is
- - A(atm), C(cpl), G(glc) , I(ice), L(clm), O(ocn),
- - W(wav) or blank (all components)
- - _L* = set run length y, m, d, h, s, n(nsteps) plus integer (ie _Lm6 for 6 months)
- - _M* = set the mpilib where * is default, mpi-serial, mpich, etc
- - _N* = set NINST_ env value to * where * is an integer
- - _P* = set pecount to specific values include T,S,M,L,X,1,1x1,16,16x1,4x4, etc
- - -pecount <name> Value of S,M,L,X1,X2 (optional).
- - default: M, partially redundant with confopts _P
- - -pes_file <name> Full pathname of pes file to use (will overwrite default settings) (optional).
- - See sample_pes_file.xml for an example.
- - -user_compset Long name for new user compset to use (optional)
- - This assumes that all of the compset settings in the long name have been defined
- - in ccsm_utils/Case.template/config_compsets.xml
- - -user_grid_file <name> Full pathname of grid file to use (optional)
- - This should be a "copy" of ccsm_utils/Case.template/config_grid.xml with the
- - new user grid changes added to it
- - -help [or -h] Print usage to STDOUT (optional).
- - -list <type> Only list valid values, type can be [compsets, grids, machines] (optional).
- - -testlist List valid values for tests [normally only invoked by create_test] (optional).
- - -silent [or -s] Turns on silent mode - only fatal messages issued (optional).
- - -verbose [or -v] Turn on verbose echoing of settings made by create_newcase (optional).
- - -xmlmode <name> Sets format of xml files; normal or expert (optional). (default is normal)
- - -nowarning Turns off checking of the known_problems repository. (default is on)
- - -sharedlibroot Used for re-using build components when building multiple CESM cases, default is \$EXEROOT
- -
- - The following two arguments turn on single point mode. If one is given -- both MUST be given.
- -
- - EXAMPLES
- -
- - ./create_newcase -case mycase1 -res f19_g16 -compset B1850CN -mach yellowstone
- +
- +SYNOPSIS
- + create_newcase [options]
- +
- +OPTIONS
- + User supplied values are denoted in angle brackets (<>). Any value that contains
- + white-space must be quoted. Long option names may be supplied with either single
- + or double leading dashes. A consequence of this is that single letter options may
- + NOT be bundled.
- +
- + -case <name> Specifies the case name (required).
- + -compset <name> Specify a CESM compset (required).
- + -res <name> Specify a CESM grid resolution (required).
- + -mach <name> Specify a CESM machine (required).
- + -project <name> Specify a project id for the case (optional)
- + default: user-specified environment variable PROJECT or ACCOUNT
- + or read from ~/.cesm_proj or ~/.ccsm_proj
- + -compiler <name> Specify a compiler for the target machine (optional)
- + default: default compiler for the target machine
- + -mpilib <name> Specify a mpi library for the target machine (optional)
- + default: default mpi library for the target machine
- + allowed: openmpi, mpich, ibm, mpi-serial, etc
- + redundant with _M confopts setting
- + -mach_dir <path> Specify the locations of the Machines directory (optional).
- + default: $machdir
- + -user_mods_dir <path> Path to directory with user_nl_* files and xmlchange_cmnds to use (optional).
- + -confopts <value> Specify some addition configuration options (optional)
- + _AOA = aoflux on atm grid
- + _AOE = aoflux on exch grid
- + _CG = gregorian calendar
- + _D = debug
- + _E = esmf interfaces
- + _IOP*= PnetCDF IO test where * is
- + A(atm), C(cpl), G(glc) , I(ice), L(clm), O(ocn),
- + W(wav) or blank (all components)
- + _L* = set run length y, m, d, h, s, n(nsteps) plus integer (ie _Lm6 for 6 months)
- + _M* = set the mpilib where * is default, mpi-serial, mpich, etc
- + _N* = set NINST_ env value to * where * is an integer
- + _P* = set pecount to specific values include T,S,M,L,X,1,1x1,16,16x1,4x4,16x1D, etc
- + -pecount <name> Value of S,M,L,X1,X2 (optional).
- + default: M, partially redundant with confopts _P
- + -pes_file <name> Full pathname of pes file to use (will overwrite default settings) (optional).
- + See sample_pes_file.xml for an example.
- + -user_compset Long name for new user compset to use (optional)
- + This assumes that all of the compset settings in the long name have been defined
- + in ccsm_utils/Case.template/config_compsets.xml
- + -user_grid_file <name> Full pathname of grid file to use (optional)
- + This should be a "copy" of ccsm_utils/Case.template/config_grid.xml with the
- + new user grid changes added to it
- + -nosavetiming Change the default for SAVE_TIMING in env_run.xml to .FALSE. (optional).
- + -help [or -h] Print usage to STDOUT (optional).
- + -list <type> Only list valid values, type can be [compsets, grids, machines] (optional).
- + -testlist List valid values for tests [normally only invoked by create_test] (optional).
- + -silent [or -s] Turns on silent mode - only fatal messages issued (optional).
- + -verbose [or -v] Turn on verbose echoing of settings made by create_newcase (optional).
- + -xmlmode <name> Sets format of xml files; normal or expert (optional). (default is normal)
- + -nowarning Turns off checking of the known_problems repository. (default is on)
- + -sharedlibroot Used for re-using build components when building multiple CESM cases, default is \$EXEROOT
- +
- +EXAMPLES
- +
- + ./create_newcase -case mycase1 -res f19_g16 -compset B1850CN -mach yellowstone
- ./create_newcase -case mycase2 -res f19_g16 -compset B1850CN -mach yellowstone -confopts _D_P16
- ./create_newcase -case mycase4 -res f19_g16 -compset MYCOMP -compset_file mycompset_file -mach yellowstone
- ./create_newcase -case mycase5 -res f19_g16 -compset B1850CN -mach yellowstone -confopts _CG_E -pes_file mypes_file
- @@ -153,6 +158,7 @@ GetOptions(
- "case=s" => \$opts{'case'},
- "compset=s" => \$opts{'compset'},
- "confopts=s" => \$opts{'confopts'},
- + "project=s" => \$opts{'project'},
- "compiler=s" => \$opts{'compiler'},
- "mpilib=s" => \$opts{'mpilib'},
- "res=s" => \$opts{'res'},
- @@ -165,14 +171,15 @@ GetOptions(
- "pes_file=s" => \$opts{'pes_file'},
- "compset_file=s" => \$opts{'compset_file'},
- "user_grid_file=s" => \$opts{'user_grid_file'},
- + "nosavetiming" => \$opts{'nosavetiming'},
- "s|silent" => \$opts{'silent'},
- "testname=s" => \$opts{'testname'},
- "testlist" => \$opts{'testlist'},
- "v|verbose" => \$opts{'verbose'},
- "xmlmode=s" => \$opts{'xmlmode'},
- - "nowarning" => \$opts{'nowarning'},
- + "nowarning" => \$opts{'nowarning'},
- "user_compset=s" => \$opts{'user_compset'},
- - "sharedlibroot=s" => \$opts{'sharedlibroot'},
- + "sharedlibroot=s" => \$opts{'sharedlibroot'},
- ) or usage();
- # Give usage message.
- @@ -196,6 +203,7 @@ my $mach;
- my $testname;
- my $pecount;
- my $xmlmode;
- +my $project;
- my $compiler;
- my $mpilib;
- if (!$opts{'list'} && !$opts{'testlist'}) {
- @@ -229,6 +237,7 @@ if (!$opts{'list'} && !$opts{'testlist'}) {
- die "ERROR: create_newcase must include the input argument, -res\n";
- }
- +
- # Check for manditory machine input
- if ($opts{'mach'}) {
- $mach = $opts{'mach'};
- @@ -372,6 +381,10 @@ my @dirs = ($cfgdir, "$cfgdir/ccsm_utils/Case.template", "$cfgdir/ccsm_utils/Too
- unshift @INC, @dirs;
- require XML::Lite;
- require ConfigCase;
- +require ProjectTools;
- +require Testing::CESMTest;
- +require Testing::TestLists;
- +
- #-----------------------------------------------------------------------------------------------
- # If just listing valid values then exit after completion of lists
- @@ -381,12 +394,15 @@ if ($opts{'testlist'}) {
- if ($opts{'list'}) {
- if ($opts{'list'} eq "compsets") {
- list_compsets($compset_file);
- - }
- - if ($opts{'list'} eq "grids") {
- + } elsif ($opts{'list'} eq "grids") {
- list_grids($grid_file);
- - }
- - if ($opts{'list'} eq "machines") {
- + } elsif ($opts{'list'} eq "machines") {
- ConfigCase::print_machines("$machdir/$machine_file");
- + } else {
- + die <<"EOF";
- +** Bad argument to the list option: $opts{'list'}
- + Valid options: compsets, grids or machines **
- +EOF
- }
- &check_known_problems();
- if ($print>=2) { print "finished listing valid values, now exiting $eol"; }
- @@ -418,14 +434,14 @@ my $fh = IO::File->new($file, '>' ) or die "can't open file: $file\n";
- print $fh "$commandline\n\n\n";
- $fh->close;
- -my ($compset_longname, $compset_shortname, $grid_longname, $grid_shortname);
- +my ($compset_longname, $compset_shortname, $grid_longname, $grid_shortname, $support_level);
- if ($opts{'user_compset'}) {
- my $user_compset = $opts{'user_compset'};
- - ($compset_longname, $compset_shortname, $grid_longname, $grid_shortname) =
- + ($compset_longname, $compset_shortname, $grid_longname, $grid_shortname, $support_level) =
- set_compset($compset_file, $user_compset, $grid_file, $grid, $cfg_ref, $caseroot,
- $user_compset);
- } else {
- - ($compset_longname, $compset_shortname, $grid_longname, $grid_shortname) =
- + ($compset_longname, $compset_shortname, $grid_longname, $grid_shortname, $support_level) =
- set_compset($compset_file, $compset, $grid_file, $grid, $cfg_ref, $caseroot);
- }
- if ($print>=2) { print "Compset specifier: $compset.$eol"; }
- @@ -441,6 +457,29 @@ check_grid("$cfgdir/ccsm_utils/Case.template/config_compsets.xml", $grid, $comps
- if ($print>=2) { print "Grid is valid for input compset. $eol"; }
- #-----------------------------------------------------------------------------------------------
- +# Inform the user of the current support level for the compset they are attempting to run.
- +#-----------------------------------------------------------------------------------------------
- +my $testsforcase;
- +if ( $opts{'compset'} ) {
- + my %case;
- + $case{'compset'} = $opts{'compset'};
- + $case{'grid'} = $opts{'res'};
- + my $testlistobj = Testing::TestLists->new(scriptsdir => $cfgdir);
- + $testsforcase = $testlistobj->findTestsForCase(\%case);
- +} else {
- + $testsforcase = "WARNING!:: User compset names are NOT tested by the standard CESM process.\n" .
- + " Thus you may likely find that this configuration will NOT work.\n" .
- + " And you are completely on your own to figure out how to get it working.";
- +}
- +my $banner = '-' x 80;
- +print "$banner\n";
- +if ( defined($support_level) ) {
- + print "Compset and grid support levels for this case are:\n";
- + print "$support_level\n";
- +}
- +print "$testsforcase\n";
- +print "$banner";
- +#-----------------------------------------------------------------------------------------------
- # (4) Machine parameters
- if ($mach =~ /(.*)_(.*)/){
- @@ -501,6 +540,21 @@ if (defined $opts{'confopts'}) {
- }
- #-----------------------------------------------------------------------------------------------
- +# (7) Set project id
- +#-----------------------------------------------------------------------------------------------
- +
- +# Check for optional project; if not given, see if we can find a project to use
- +if ($opts{'project'}) {
- + $project = $opts{'project'};
- +}
- +else {
- + $project = ProjectTools::find_project();
- +}
- +
- +ProjectTools::check_project_required_but_unset($project, $cfg_ref);
- +ProjectTools::set_project($project, $cfg_ref);
- +
- +#-----------------------------------------------------------------------------------------------
- # (8) Determine pes for machine
- #-----------------------------------------------------------------------------------------------
- @@ -532,9 +586,10 @@ if (defined $opts{'pes_file'}) {
- $cfg_ref->reset_setup("$pes_file");
- } else {
- - if ($pecount =~ m!^([0-9]+)$!) {
- + if ($pecount =~ m!^([0-9]+)D?$!) {
- my $ntasks = $1;
- my $nthrds = 1;
- + my $root = 0;
- $decomp{NTASKS_ATM} = $ntasks; $decomp{NTHRDS_ATM} = $nthrds;
- $decomp{NTASKS_LND} = $ntasks; $decomp{NTHRDS_LND} = $nthrds;
- $decomp{NTASKS_OCN} = $ntasks; $decomp{NTHRDS_OCN} = $nthrds;
- @@ -543,9 +598,20 @@ if (defined $opts{'pes_file'}) {
- $decomp{NTASKS_ROF} = $ntasks; $decomp{NTHRDS_ROF} = $nthrds;
- $decomp{NTASKS_WAV} = $ntasks; $decomp{NTHRDS_WAV} = $nthrds;
- $decomp{NTASKS_CPL} = $ntasks; $decomp{NTHRDS_CPL} = $nthrds;
- - } elsif ($pecount =~ m!^([0-9]+)x([0-9]+)$!) {
- + if ($pecount =~ m!^([0-9]+)D$!) {
- + $root = 0 ; $decomp{ROOTPE_ATM} = $root;
- + $root = 1 * $ntasks; $decomp{ROOTPE_LND} = $root;
- + $root = 2 * $ntasks; $decomp{ROOTPE_OCN} = $root;
- + $root = 3 * $ntasks; $decomp{ROOTPE_ICE} = $root;
- + $root = 4 * $ntasks; $decomp{ROOTPE_GLC} = $root;
- + $root = 5 * $ntasks; $decomp{ROOTPE_WAV} = $root;
- + $root = 6 * $ntasks; $decomp{ROOTPE_ROF} = $root;
- + $root = 7 * $ntasks; $decomp{ROOTPE_CPL} = $root;
- + }
- + } elsif ($pecount =~ m!^([0-9]+)x([0-9]+)D?$!) {
- my $ntasks = $1;
- my $nthrds = $2;
- + my $root = 0;
- $decomp{NTASKS_ATM} = $ntasks; $decomp{NTHRDS_ATM} = $nthrds;
- $decomp{NTASKS_LND} = $ntasks; $decomp{NTHRDS_LND} = $nthrds;
- $decomp{NTASKS_OCN} = $ntasks; $decomp{NTHRDS_OCN} = $nthrds;
- @@ -554,6 +620,16 @@ if (defined $opts{'pes_file'}) {
- $decomp{NTASKS_WAV} = $ntasks; $decomp{NTHRDS_WAV} = $nthrds;
- $decomp{NTASKS_ROF} = $ntasks; $decomp{NTHRDS_ROF} = $nthrds;
- $decomp{NTASKS_CPL} = $ntasks; $decomp{NTHRDS_CPL} = $nthrds;
- + if ($pecount =~ m!^([0-9]+)x([0-9]+)D$!) {
- + $root = 0 ; $decomp{ROOTPE_ATM} = $root;
- + $root = 1 * $ntasks; $decomp{ROOTPE_LND} = $root;
- + $root = 2 * $ntasks; $decomp{ROOTPE_OCN} = $root;
- + $root = 3 * $ntasks; $decomp{ROOTPE_ICE} = $root;
- + $root = 4 * $ntasks; $decomp{ROOTPE_GLC} = $root;
- + $root = 5 * $ntasks; $decomp{ROOTPE_WAV} = $root;
- + $root = 6 * $ntasks; $decomp{ROOTPE_ROF} = $root;
- + $root = 7 * $ntasks; $decomp{ROOTPE_CPL} = $root;
- + }
- } else {
- # Need the test name with the options passed to ConfigCase->set_pes
- # so that if we want to exclude or include a PE layout for a test, we
- @@ -742,6 +818,7 @@ foreach my $xvar ( @xvars ) {
- my $ccsmuser = "$ENV{'LOGNAME'}";
- $cfg_ref->set('CCSMUSER', "$ccsmuser");
- +
- $cfg_ref->set('CASEROOT', "$caseroot");
- $cfg_ref->set('CASE' , "$case");
- $cfg_ref->set('CCSMROOT', "$ccsmroot");
- @@ -776,7 +853,7 @@ my $scriptsroot = "$ccsmroot/scripts";
- print "Creating $caseroot $eol";
- # Create relevant directories in $caseroot
- -my @mkdirs = qw(. SourceMods LockedFiles Buildconf Tools/XML/Lite);
- +my @mkdirs = qw(. SourceMods LockedFiles Buildconf Tools/XML/Lite Tools/pythonlib);
- foreach my $mkdir ( @mkdirs ) {
- $sysmod = "mkdir -p $caseroot/$mkdir";
- system($sysmod) == 0 or die "ERROR: $sysmod failed: $?\n";
- @@ -792,6 +869,9 @@ my @files = (
- "$scriptsroot/ccsm_utils/Tools/xmlchange",
- "$scriptsroot/ccsm_utils/Tools/xmlquery",
- "$scriptsroot/ccsm_utils/Tools/st_archive",
- + "$scriptsroot/ccsm_utils/Tools/tseries_generate.submit",
- + "$scriptsroot/ccsm_utils/Tools/tseries_generate.run",
- + "$scriptsroot/ccsm_utils/Tools/README.post_process",
- );
- foreach my $file (@files) {
- $sysmod = "cp -p $file $caseroot";
- @@ -814,6 +894,8 @@ system($sysmod) == 0 or die "ERROR: $sysmod failed: $?\n";
- "$scriptsroot/ccsm_utils/Tools/st_archive",
- "$scriptsroot/ccsm_utils/Tools/user_nlcreate",
- "$scriptsroot/ccsm_utils/Tools/user_nl_add",
- + "$scriptsroot/ccsm_utils/Tools/mdiag_reduce.csh",
- + "$scriptsroot/ccsm_utils/Tools/mdiag_reduce.pl",
- "$scriptsroot/ccsm_utils/Tools/timing/getTiming.csh",
- "$scriptsroot/ccsm_utils/Tools/timing/getTiming2.pl",
- "$scriptsroot/ccsm_utils/Case.template/config_definition.xml",
- @@ -823,7 +905,12 @@ system($sysmod) == 0 or die "ERROR: $sysmod failed: $?\n";
- "$scriptsroot/ccsm_utils/Case.template/config_archive.xsd",
- "$scriptsroot/ccsm_utils/Case.template/ConfigCase.pm",
- "$scriptsroot/ccsm_utils/Tools/SetupTools.pm",
- - "$scriptsroot/ccsm_utils/Tools/compare_namelists.pl",
- + "$scriptsroot/acme/acme_util.py",
- + "$scriptsroot/acme/compare_namelists",
- + "$scriptsroot/acme/compare_namelists.py",
- + "$scriptsroot/acme/simple_compare",
- + "$scriptsroot/acme/simple_compare.py",
- + "$scriptsroot/ccsm_utils/Tools/cesm_tseries_generator.py",
- "$machdir/taskmaker.pl",
- "$machdir/Makefile",
- "$machdir/mkSrcfiles",
- @@ -834,6 +921,13 @@ foreach my $file (@files) {
- system($sysmod) == 0 or die "ERROR: $sysmod failed: $?\n";
- }
- +# Copy relevant files into $caseroot/Tools/pythonlib
- +@files = ("$scriptsroot/ccsm_utils/Tools/pythonlib/cesmEnvLib.py");
- +foreach my $file (@files) {
- + $sysmod = "cp -p $file $caseroot/Tools/pythonlib/.";
- + system($sysmod) == 0 or die "ERROR: $sysmod failed: $?\n";
- +}
- +
- # Create $case.build
- my $file = "${caseroot}/${case}.build";
- $sysmod = "cp ${caseroot}/Tools/cesm_buildstart $file";
- @@ -856,7 +950,7 @@ $sysmod = "cp $scriptsroot/ccsm_utils/Tools/cesm_submit $caseroot/$case.submit"
- system($sysmod) == 0 or die "ERROR: $sysmod failed: $?\n";
- # Create $case.l_archive
- -my $sysmod = "env CCSMUSER=$ccsmuser CASE=$case CASEROOT=$caseroot env PHASE=set_larch ${machdir}/mkbatch.$mach";
- +my $sysmod = "env CCSMUSER=$ccsmuser CASE=$case CASEROOT=$caseroot PROJECT=$project env PHASE=set_larch ${machdir}/mkbatch.$mach";
- system($sysmod) == 0 or die "ERROR: $sysmod failed: $?\n";
- # Create preview_namelist file
- @@ -970,6 +1064,10 @@ if(-e "$machdir/env_mach_specific.$mach" ) {
- system($sysmod) == 0 or die "ERROR: $sysmod failed: $?\n";
- # Copy Depends files if they exist
- +if( -e "$machdir/Depends.$mach.$compiler" ) {
- + $sysmod = "cp $machdir/Depends.$mach.$compiler $caseroot/";
- + system($sysmod) == 0 or die "ERROR: $sysmod failed: $?\n";
- +}else{
- if( -e "$machdir/Depends.$mach" ) {
- $sysmod = "cp $machdir/Depends.$mach $caseroot/";
- system($sysmod) == 0 or die "ERROR: $sysmod failed: $?\n";
- @@ -978,6 +1076,16 @@ if( -e "$machdir/Depends.$compiler" ) {
- $sysmod = "cp $machdir/Depends.$compiler $caseroot/";
- system($sysmod) == 0 or die "ERROR: $sysmod failed: $?\n";
- }
- +}
- +
- +# The following creates mach_syslog
- +if( -e "$machdir/syslog.$mach" ) {
- + $sysmod = "cp $machdir/syslog.$mach $caseroot/Tools/mach_syslog";
- + system($sysmod) == 0 or die "ERROR: $sysmod failed: $?\n";
- +}else{
- + $sysmod = "cp $machdir/syslog.generic $caseroot/Tools/mach_syslog";
- + system($sysmod) == 0 or die "ERROR: $sysmod failed: $?\n";
- +}
- # Write the xml files
- $cfg_ref->write_file("$caseroot/env_case.xml" , "xml");
- @@ -991,6 +1099,15 @@ print "Created $caseroot/env_run.xml \n";
- $cfg_ref->write_file("$caseroot/env_archive.xml" , "xml", "$scriptsroot/ccsm_utils/Case.template");
- print "Created $caseroot/env_archive.xml \n";
- +# set the default to not archive performance data and associated provenance
- +if ($opts{'nosavetiming'}) {
- + my $cwd = getcwd(); # current working directory
- + chdir "$caseroot";
- + $sysmod = './xmlchange -file env_run.xml -id SAVE_TIMING -val "FALSE"';
- + system($sysmod) == 0 or die "ERROR: $sysmod failed: $?\n";
- + chdir "$cwd";
- +}
- +
- # Copy env_case.xml in to locked files
- $sysmod = "cp $caseroot/env_case.xml $caseroot/LockedFiles/env_case.xml.locked";
- system($sysmod) == 0 or die "ERROR: $sysmod failed: $?\n";
- @@ -1061,7 +1178,20 @@ if ( defined($user_mods_dir) ) {
- }
- #-----------------------------------------------------------------------------------------------
- -# (11) Create $caseroot run setup scripts (other than batch)
- +# (11) check that the pyreshaper tool is installed in the inputdata location on the machine
- +#-----------------------------------------------------------------------------------------------
- +
- +#my $cmd = "module load python";
- +#system($cmd) == 0 or warn "WARNING: unable to execute '$cmd'";
- +#$cmd = "module load all-python-libs";
- +#system($cmd) == 0 or warn "WARNING: unable to execute '$cmd'";
- +#$cmd = "pushd $ccsmroot/tools/pyReshaper";
- +#system($cmd) == 0 or warn "WARNING: unable to execute '$cmd'";
- +#$cmd = "python setup.py install --
- +
- +
- +#-----------------------------------------------------------------------------------------------
- +# (12) Create $caseroot run setup scripts (other than batch)
- #-----------------------------------------------------------------------------------------------
- print "Successfully created the case for $mach \n";
- @@ -1237,6 +1367,7 @@ sub set_compset
- my $compset_shortname= $compset;
- my $compset_aliasname= $compset;
- + my $support_level = undef;
- my $desc_comp = "";
- my $desc_grid = "";
- my $temp;
- @@ -1257,12 +1388,13 @@ sub set_compset
- NAME:
- while ( my $e = shift @e ) {
- $found = 0;
- - my $sname, my $alias; my $lname;
- + my $sname, my $alias; my $lname; my $support;
- $lname = clean($e->get_text());
- %attr = $e->get_attributes();
- if ($attr{'sname'}) {
- $sname = clean($attr{'sname'});
- if ($attr{'alias'}) {$alias = clean($attr{'alias'})};
- + if ($attr{'support_level'}) {$support = clean($attr{'support_level'})};
- } else {
- die "set_compset: config_compsets.xml must have COMPSET element and SNAME attribute \n";
- }
- @@ -1270,6 +1402,9 @@ NAME:
- $compset_longname = $lname;
- $compset_shortname = $sname;
- $compset_aliasname = $alias;
- + if ( $support ) {
- + $support_level .= "Compset ($sname): $support\n";
- + }
- $temp = $lname . $sname;
- $cfg_ref->set('CCSM_COMPSET' , "$lname");
- $cfg_ref->set('CCSM_LCOMPSET', "$lname");
- @@ -1292,7 +1427,7 @@ NAME:
- my $atm_grid, my $lnd_grid, my $ice_grid, my $ocn_grid;
- my $rof_grid, my $glc_grid, my $wav_grid;
- - my $cism_grid, my $mask_grid;
- + my $mask_grid;
- # first determine if there is any compset attribute for this grid
- $found = 0;
- @@ -1300,14 +1435,18 @@ NAME:
- NAME:
- @e = $xml_grid->elements_by_name( "GRID" );
- while ( my $e = shift @e ) {
- - my $sname, my $alias;
- + my $sname, my $alias; my $support;
- my $lname = clean($e->get_text());
- my %attr = $e->get_attributes();
- $sname = clean($attr{'sname'});
- $alias = clean($attr{'alias'});
- + $support = clean($attr{'support_level'});
- if ($grid =~ /$lname/ || $grid eq $sname || $grid eq $alias) {
- if ($attr{'compset'}) {
- if ($compset_longname =~ /$attr{'compset'}/) {
- + if ( $support ) {
- + $support_level .= "Grid ($sname): $support\n";
- + }
- $grid_longname = $lname;
- $grid_shortname = $sname;
- $grid_aliasname = $alias;
- @@ -1322,16 +1461,20 @@ NAME:
- if ($found == 0) {
- @e = $xml_grid->elements_by_name( "GRID" );
- while ( my $e = shift @e ) {
- - my $sname, my $alias;
- + my $sname, my $alias; my $support;
- my $lname = clean($e->get_text());
- my %attr = $e->get_attributes();
- $sname = clean($attr{'sname'});
- $alias = clean($attr{'alias'});
- + $support = clean($attr{'support_level'});
- if ($grid =~ /$lname/ || $grid eq $sname || $grid eq $alias) {
- if ($attr{'compset'}) {
- # do nothing
- } else {
- print " grid longname is $grid_longname \n";
- + if ( $support ) {
- + $support_level .= "Grid ($sname): $support\n";
- + }
- $grid_longname = $lname;
- $grid_shortname = $sname;
- $grid_aliasname = $alias;
- @@ -1351,15 +1494,12 @@ NAME:
- }
- $grid_longname =~ /(a%)(.+)(_l%)/ ; $atm_grid = $2;
- - $grid_longname =~ /(l%)(.+)(_oi%)/; $lnd_grid = $2; $glc_grid = $2;
- + $grid_longname =~ /(l%)(.+)(_oi%)/; $lnd_grid = $2;
- $grid_longname =~ /(oi%)(.+)(_r%)/; $ocn_grid = $2; $ice_grid = $2;
- $grid_longname =~ /(r%)(.+)(_m%)/ ; $rof_grid = $2;
- $grid_longname =~ /(m%)(.+)(_g%)/ ; $mask_grid = $2;
- - $grid_longname =~ /(g%)(.+)(_w%)/ ; $cism_grid = $2;
- + $grid_longname =~ /(g%)(.+)(_w%)/ ; $glc_grid = $2;
- $grid_longname =~ /(w%)(.+)$/ ; $wav_grid = $2;
- - if ($cism_grid ne 'null') {
- - $cfg_ref->set('CISM_GRID',$cism_grid);
- - }
- # ========================================================
- # check that compset is supported for target grid
- @@ -1391,7 +1531,7 @@ NAME:
- @e = $xml_grid->elements_by_name( "gridhorz" );
- while ( my $e = shift @e ) {
- - my $nx, my $ny;
- + my $nx, my $ny; my $support;
- my %attr = $e->get_attributes();
- my $hgrid = clean($attr{'name'});
- my $alias = clean($attr{'alias'});
- @@ -1401,8 +1541,14 @@ NAME:
- my $name = clean($child->get_name());
- if ($name eq 'nx') {$nx = $val;}
- if ($name eq 'ny') {$ny = $val;}
- + if ($name eq 'support_level') {$support = $val;}
- + # WARNING!!!:: THE LOGIC HERE IS DEPENDENT ON THE ORDER OF THE FIELDS WITHIN
- + # EACH gridhorz FIELD desc MUST BE LAST!
- if ($name eq 'desc') {
- if ($grid_longname =~ /$hgrid/) {
- + if ( $support ) {
- + $support_level .= "Grid ($hgrid): $support\n";
- + }
- if ($desc_grid =~ m/$val/) {
- # do nothing
- } else {
- @@ -1448,11 +1594,9 @@ NAME:
- if ($mask_grid eq $hgrid) {
- $cfg_ref->set('MASK_GRID',$gridname);
- }
- - if ($cism_grid eq $hgrid) {
- - $cfg_ref->set('CISM_GRID',$gridname);
- - }
- }
- +
- my $atm_grid = $cfg_ref->get('ATM_GRID');
- my $lnd_grid = $cfg_ref->get('LND_GRID');
- my $ocn_grid = $cfg_ref->get('OCN_GRID');
- @@ -1614,7 +1758,7 @@ NAME:
- my $newval = $val;
- # For OCN_TRACER_MODULES want to merge, not replace, options.
- - if ($name =~ m/OCN_TRACER_MODULES/) {
- + if ($name eq "OCN_TRACER_MODULES") {
- my $curval = $cfg_ref->get($id);
- if ($val =~ /$curval/) {
- #do nothing
- @@ -1759,11 +1903,6 @@ NAME:
- $nxw = $cfg_ref->get('WAV_NX'); $nyw= $cfg_ref->get('WAV_NY');
- $grw = $cfg_ref->get('WAV_GRID');
- - if ($compset_longname =~ /CISM/) {
- - $grid = $cfg_ref->get('CISM_GRID');
- - print " CISM_GRID = $grid \n";
- - }
- -
- # output to standard out
- print "Component set: longname (shortname) (alias) \n";
- if ($compset_aliasname) {
- @@ -1819,7 +1958,7 @@ NAME:
- print $fh " $id: $newout{$id} \n";
- }
- - return ($compset_longname, $compset_shortname, $grid_longname, $grid_shortname);
- + return ($compset_longname, $compset_shortname, $grid_longname, $grid_shortname, $support_level);
- }
- #-------------------------------------------------------------------------------
- @@ -2033,61 +2172,61 @@ sub list_grids
- $name eq "config_compset" or die
- "file $grid_file is not a horizontal grid parameters file\n";
- - # Naming convention
- - my @e = $xml->elements_by_name( "help" );
- - while ( my $e = shift @e ) {
- - my $text = clean($e->get_text());
- - print "$text \n\n";
- + # Naming convention
- + my @e = $xml->elements_by_name( "help" );
- + while ( my $e = shift @e ) {
- + my $text = clean($e->get_text());
- + print "$text \n\n";
- + }
- + print "\n";
- + # Component grids
- + print "======================================================\n";
- + print ("Component Grids: name\t(alias)\t(desc)\t(nx)\t(ny) \n");
- + print "======================================================\n";
- + my @e = $xml->elements_by_name( "gridhorz" );
- + my %a = ();
- + while ( my $e = shift @e ) {
- + my %attr = $e->get_attributes();
- + my $hgrid = clean($attr{'name'});
- + my $alias = clean($attr{'alias'});
- + my $gridname;
- + printf " %-20s ", $hgrid;
- + foreach my $item ( "alias" ) {
- + if ($attr{$item}) {
- + print " ($item: $attr{$item})";
- + }
- }
- - print "\n";
- - # Component grids
- - print "======================================================\n";
- - print ("Component Grids: name\t(alias)\t(desc)\t(nx)\t(ny) \n");
- - print "======================================================\n";
- - my @e = $xml->elements_by_name( "gridhorz" );
- - my %a = ();
- - while ( my $e = shift @e ) {
- - my %attr = $e->get_attributes();
- - my $hgrid = clean($attr{'name'});
- - my $alias = clean($attr{'alias'});
- - my $gridname;
- - printf " %-20s ", $hgrid;
- - foreach my $item ( "alias" ) {
- - if ($attr{$item}) {
- - print " ($item: $attr{$item})";
- - }
- - }
- - my @children = $e->get_children();
- - my %elements = undef;
- - foreach my $child (@children) {
- - my $name = clean($child->get_name());
- - $elements{$name} = clean($child->get_text());
- - }
- - foreach my $item ( "desc", "nx", "ny" ) {
- - if ($elements{$item}) {
- - print " ($item: $elements{$item})";
- - }
- - }
- - print " \n";
- + my @children = $e->get_children();
- + my %elements = undef;
- + foreach my $child (@children) {
- + my $name = clean($child->get_name());
- + $elements{$name} = clean($child->get_text());
- + }
- + foreach my $item ( "desc", "nx", "ny", "support_level" ) {
- + if ($elements{$item}) {
- + print " ($item: $elements{$item})";
- + }
- }
- - print (" \n");
- - # Model grids
- - print "======================================================\n";
- - print ("Model Grids: name\t(alias)\t(compset) \n");
- - print "======================================================\n";
- - my @e = $xml->elements_by_name( "GRID" );
- - while ( my $e = shift @e ) {
- - my %attr = $e->get_attributes();
- - my $text = clean($e->get_text());
- - printf "%s %-87s ", "model grid: ", $text;
- - foreach my $item ( "alias", "compset" ) {
- - if ($attr{$item}) {
- - print " ($item: $attr{$item})";
- - }
- - }
- - print "\n";
- - }
- print " \n";
- + }
- + print (" \n");
- + # Model grids
- + print "======================================================\n";
- + print ("Model Grids: name\t(alias)\t(compset) \n");
- + print "======================================================\n";
- + my @e = $xml->elements_by_name( "GRID" );
- + while ( my $e = shift @e ) {
- + my %attr = $e->get_attributes();
- + my $text = clean($e->get_text());
- + printf "%s %-87s ", "model grid: ", $text;
- + foreach my $item ( "alias", "compset", "support_level" ) {
- + if ($attr{$item}) {
- + print " ($item: $attr{$item})";
- + }
- + }
- + print "\n";
- + }
- + print " \n";
- }
- @@ -2120,8 +2259,10 @@ sub list_compsets
- my $text = clean($e->get_text());
- printf("alias: %-25s shortname: %-50s \n",
- clean($attr{'alias'}),clean($attr{'sname'}));
- - printf(" longname: %-96s \n",
- - clean($text));
- + printf(" longname: %-96s \n", clean($text) );
- + if ( $attr{'support_level'} ) {
- + printf(" support_level: %-96s \n", clean($attr{'support_level'}) );
- + }
- }
- print " \n";
- my @e = $xml_comp->elements_by_name( "help" );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement