Skip to content

Conversation

@samsrabin
Copy link
Member

@samsrabin samsrabin commented Nov 23, 2025

Description of changes

Adds a utility to compare parameter files. Compares both "raw" values and values after masking and scaling (applying _FillValue to convert missing values to NaN, multiplying by scale_factor, and adding add_offset).

Example usage; results truncated:

file0=/glade/campaign/cesm/cesmdata/cseg/inputdata/lnd/clm2/paramdata/clm_params78pftModDates.c130821.nc
file1=/glade/campaign/cesm/cesmdata/cseg/inputdata/lnd/clm2/paramdata/ctsm60_params.c251124.nc

tools/param_utils/compare_paramfiles $file0 $file1
File 0: /glade/campaign/cesm/cesmdata/cseg/inputdata/lnd/clm2/paramdata/clm_params78pftModDates.c130821.nc
File 1: /glade/campaign/cesm/cesmdata/cseg/inputdata/lnd/clm2/paramdata/ctsm60_params.c251124.nc

Variable(s) present in File 0 but not File 1:
   cn_s1_bgc
   cn_s2_bgc
   ...

Variable(s) present in File 1 but not File 0:
   C2_liq_Brun89
   FUN_fracfixers
   ...

...

allconss:
   Values differ:
      [pft 71 (miscanthus)] 0.0 → 2.0 (raw)
                            nan → 2.0 (masked/scaled)
      [pft 72 (irrigated_miscanthus)] 0.0 → 2.0 (raw)
                                      nan → 2.0 (masked/scaled)
      [pft 73 (switchgrass)] 0.0 → 2.0 (raw)
                             nan → 2.0 (masked/scaled)
      [pft 74 (irrigated_switchgrass)] 0.0 → 2.0 (raw)
                                       nan → 2.0 (masked/scaled)

...

atmch4:
   Attribute(s) present in File 1 but not File 0:
       _FillValue: nan
   Dimension names differ: File 0: ['allpfts']
                           File 1: []

baset:
   Attribute(s) present in File 1 but not File 0:
       _FillValue: nan
   Values differ:
      [pft 71 (miscanthus)] 0.0 → 8.0
      [pft 72 (irrigated_miscanthus)] 0.0 → 8.0
      [pft 73 (switchgrass)] 0.0 → 8.0
      [pft 74 (irrigated_switchgrass)] 0.0 → 8.0

...

Specific notes

Contributors other than yourself, if any: None

CTSM Issues Fixed (include github issue #): None

Are answers expected to change (and if so in what way)? No

Any User Interface Changes (namelist or namelist defaults changes)? No

Does this create a need to change or add documentation? Did you do so? Yes; yes.

Testing performed, if any: All unit and system tests pass. Results on real paramfiles look good.

  • clm_pymods test suite: Passed at /glade/derecho/scratch/samrabin/tests_1219-073947de

Only basic testing of argument parsing and checking.
@samsrabin samsrabin self-assigned this Nov 23, 2025
@samsrabin samsrabin added enhancement new capability or improved behavior of existing capability next this should get some attention in the next week or two. Normally each Thursday SE meeting. bfb bit-for-bit usability Improve or clarify user-facing options labels Nov 23, 2025
@samsrabin samsrabin requested a review from slevis-lmwg December 4, 2025 17:40
Copy link
Contributor

@slevis-lmwg slevis-lmwg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@samsrabin thank you for this impressive PR! The compare_paramfiles tool is much more informative than cprnc. Your implementation looks very well thought out and you put together a nice list of unit and sys tests.

@samsrabin and I went over this in detail and @samsrabin took notes.

@samsrabin samsrabin merged commit f7cffc6 into ESCOMP:b4b-dev Dec 19, 2025
8 checks passed
@ekluzek ekluzek mentioned this pull request Dec 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bfb bit-for-bit enhancement new capability or improved behavior of existing capability usability Improve or clarify user-facing options

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants