Enhancement request: Use realpath when comparing namelists
- Dominant language
- Python
- Stars
- 174
- Forks
- 225
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 14
Description
When comparing a test to a baseline generated by a different user, I ran into the following supposed diff in our namelists:
```
SMS_D_Ld5.5x5_amazon.I1850Clm60Bgc.derecho_gnu.clm-HillslopeC
2024-05-28 11:36:12: NLCOMP
Comparison failed between '/glade/derecho/scratch/samrabin/tests_0528-113433de/SMS_D_Ld5.5x5_amazon.I1850Clm60Bgc.derecho_gnu.clm-HillslopeC.GC.0528-113433de_gnu/CaseDocs/nuopc.runconfig' with '/glade/campaign/cgd/tss/ctsm_baselines/ctsm5.2.005/SMS_D_Ld5.5x5_amazon.I1850Clm60Bgc.derecho_gnu.clm-HillslopeC/CaseDocs/nuopc.runconfig'
DRIVER_attributes->PELAYOUT_attributes->ALLCOMP_attributes:
- mesh_atm : /glade/campaign/cesm/cesmdata/cseg/inputdata/lnd/clm2/testdata/ESMFmesh_10x15_synthetic_cosphill_1.0.nc
+ mesh_atm : /glade/campaign/cesm/cesmdata/inputdata/lnd/clm2/testdata/ESMFmesh_10x15_synthetic_cosphill_1.0.nc
DRIVER_attributes->PELAYOUT_attributes->ALLCOMP_attributes:
- mesh_lnd : /glade/campaign/cesm/cesmdata/cseg/inputdata/lnd/clm2/testdata/ESMFmesh_10x15_synthetic_cosphill_1.0.nc
+ mesh_lnd : /glade/campaign/cesm/cesmdata/inputdata/lnd/clm2/testdata/ESMFmesh_10x15_synthetic_cosphill_1.0.nc
```
I say "supposed" because the differences are only skin-deep: The new versions (`+`) resolve through an alias to match the baseline versions (`-`) exactly.
There may be reasons it is the way it is, but I feel like it'd be better for such situations to not count as diffs. I think this could be accomplished by using `os.path.realpath()` somewhere in [`_normalize_string_value()`](https://github.com/ESMCI/cime/blob/422ddaa770a3cea6e83a60c9700ebce77acaceed/CIME/compare_namelists.py#L387-L421). Although looking at that code, I see that `os.path.basename()` is used, so maybe I'm misunderstanding what's happening where.
Contributor guide
Assessment
This issue has not been assessed yet.