Repository: ESMCI/cime

Issue:
compare_namelists.py fails on case name difference 
compare_namelists should not fail if the only difference is a case file name or path
I am getting a fail in comparing against baseline where the only difference is in file names
I don't think that this should be a fail. 

```

2016-08-18 13:09:54: Using case: 'ERS.f09_g16.B1850.yellowstone_intel.allactive-cesm2dev01io'
Differences in namelist 'seq_infodata_inparm':
  BASE: case_name = 'ERS.f09_g16.B1850.yellowstone_intel.allactive-cesm2dev01io.GC.20160818_134047'
  COMP: case_name = 'ERS.f09_g16.B1850.yellowstone_intel.allactive-cesm2dev01io.GC.20160818_190902'
ERROR: Namelist diff between files /glade/p/cesmdata/cseg/ccsm_baselines/cesm2jpetest/ERS.f09_g16.B1850.yellowstone_intel.allactive-cesm2dev01io/CaseDocs/drv_in and /glade/scratch/jedwards/ERS.f09_g16.B1850.yellowstone_intel.allactive-cesm2dev01io.GC.20160818_190902/CaseDocs/drv_in
2016-08-18 13:09:55: Using case: 'ERS.f09_g16.B1850.yellowstone_intel.allactive-cesm2dev01io'
Differences in namelist 'diagnostics_nml':
  BASE: diag_outfile = ERS.f09_g16.B1850.yellowstone_intel.allactive-cesm2dev01io.GC.20160818_134047.pop.dd'
  COMP: diag_outfile = ERS.f09_g16.B1850.yellowstone_intel.allactive-cesm2dev01io.GC.20160818_190902.pop.dd'
  BASE: diag_transport_outfile = ERS.f09_g16.B1850.yellowstone_intel.allactive-cesm2dev01io.GC.20160818_134047.pop.dt'
  COMP: diag_transport_outfile = ERS.f09_g16.B1850.yellowstone_intel.allactive-cesm2dev01io.GC.20160818_190902.pop.dt'
  BASE: diag_velocity_outfile = ERS.f09_g16.B1850.yellowstone_intel.allactive-cesm2dev01io.GC.20160818_134047.pop.dv'
  COMP: diag_velocity_outfile = ERS.f09_g16.B1850.yellowstone_intel.allactive-cesm2dev01io.GC.20160818_190902.pop.dv'
Differences in namelist 'grid_nml':
  BASE: topography_outfile = ERS.f09_g16.B1850.yellowstone_intel.allactive-cesm2dev01io.GC.20160818_134047.pop.h.topography_bathymetry.ieeer8'
  COMP: topography_outfile = ERS.f09_g16.B1850.yellowstone_intel.allactive-cesm2dev01io.GC.20160818_190902.pop.h.topography_bathymetry.ieeer8'
Differences in namelist 'history_nml':
  BASE: history_outfile = ERS.f09_g16.B1850.yellowstone_intel.allactive-cesm2dev01io.GC.20160818_134047.pop.hs'
  COMP: history_outfile = ERS.f09_g16.B1850.yellowstone_intel.allactive-cesm2dev01io.GC.20160818_190902.pop.hs'
Differences in namelist 'hmix_aniso_nml':
  BASE: var_viscosity_outfile = ERS.f09_g16.B1850.yellowstone_intel.allactive-cesm2dev01io.GC.20160818_134047.pop.hv'
  COMP: var_viscosity_outfile = ERS.f09_g16.B1850.yellowstone_intel.allactive-cesm2dev01io.GC.20160818_190902.pop.hv'
Differences in namelist 'init_ts_nml':
  BASE: init_ts_outfile = ERS.f09_g16.B1850.yellowstone_intel.allactive-cesm2dev01io.GC.20160818_134047.pop.h.ts_ic'
  COMP: init_ts_outfile = ERS.f09_g16.B1850.yellowstone_intel.allactive-cesm2dev01io.GC.20160818_190902.pop.h.ts_ic'
Differences in namelist 'movie_nml':
  BASE: movie_outfile = ERS.f09_g16.B1850.yellowstone_intel.allactive-cesm2dev01io.GC.20160818_134047.pop.hm'
  COMP: movie_outfile = ERS.f09_g16.B1850.yellowstone_intel.allactive-cesm2dev01io.GC.20160818_190902.pop.hm'
Differences in namelist 'overflows_nml':
  BASE: overflows_diag_outfile = ERS.f09_g16.B1850.yellowstone_intel.allactive-cesm2dev01io.GC.20160818_134047.pop.do'
  COMP: overflows_diag_outfile = ERS.f09_g16.B1850.yellowstone_intel.allactive-cesm2dev01io.GC.20160818_190902.pop.do'
  BASE: overflows_restfile = ERS.f09_g16.B1850.yellowstone_intel.allactive-cesm2dev01io.GC.20160818_134047.pop.ro'
  COMP: overflows_restfile = ERS.f09_g16.B1850.yellowstone_intel.allactive-cesm2dev01io.GC.20160818_190902.pop.ro'
Differences in namelist 'restart_nml':
  BASE: restart_outfile = ERS.f09_g16.B1850.yellowstone_intel.allactive-cesm2dev01io.GC.20160818_134047.pop.r'
  COMP: restart_outfile = ERS.f09_g16.B1850.yellowstone_intel.allactive-cesm2dev01io.GC.20160818_190902.pop.r'
Differences in namelist 'tavg_nml':
  BASE: tavg_infile = ERS.f09_g16.B1850.yellowstone_intel.allactive-cesm2dev01io.GC.20160818_134047.pop.hrestart.end'
  COMP: tavg_infile = ERS.f09_g16.B1850.yellowstone_intel.allactive-cesm2dev01io.GC.20160818_190902.pop.hrestart.end'
  BASE: tavg_outfile = ERS.f09_g16.B1850.yellowstone_intel.allactive-cesm2dev01io.GC.20160818_134047.pop.h'
  COMP: tavg_outfile = ERS.f09_g16.B1850.yellowstone_intel.allactive-cesm2dev01io.GC.20160818_190902.pop.h'
ERROR: Namelist diff between files /glade/p/cesmdata/cseg/ccsm_baselines/cesm2jpetest/ERS.f09_g16.B1850.yellowstone_intel.allactive-cesm2dev01io/CaseDocs/pop_in and /glade/scratch/jedwards/ERS.f09_g16.B1850.yellowstone_intel.allactive-cesm2dev01io.GC.20160818_190902/CaseDocs/pop_in
```



Discussion:

Resolving patch:
diff --git a/utils/python/CIME/compare_namelists.py b/utils/python/CIME/compare_namelists.py
--- a/utils/python/CIME/compare_namelists.py
+++ b/utils/python/CIME/compare_namelists.py
@@ -88,7 +88,7 @@ def parse_namelists(namelist_lines, filename):
             expect(multiline_variable is None,
                    "In file '%s', Incomplete multiline variable: '%s'" % (filename, multiline_variable[0] if multiline_variable is not None else ""))
 
-            # Unfornately, other tools were using the old compare_namelists.pl script
+            # Unfortunately, other tools were using the old compare_namelists.pl script
             # to compare files that are not namelist files. We need a special error
             # to signify this event
             if (namelist_re.match(line) is None):
@@ -192,7 +192,7 @@ def normalize_string_value(name, value, case):
     """
     # Any occurance of case must be normalized because test-ids might not match
     if (case is not None):
-        case_re = re.compile(r'%s[.]([GC])[.]([^./\s]+)' % case)
+        case_re = re.compile(r'%s[.]([GC]+)[.]([^./\s]+)' % case)
         value = case_re.sub("%s.ACTION.TESTID" % case, value)
 
     if (name in ["runid", "model_version", "username"]):


Test patch: